generate database schemas

This commit is contained in:
Hayden 2022-08-30 10:04:50 -08:00
parent 4c76f6b367
commit 63cfeffc4d
70 changed files with 26933 additions and 1398 deletions

View file

@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package hook
@ -22,6 +22,71 @@ func (f AuthTokensFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value,
return f(ctx, mv)
}
// The GroupFunc type is an adapter to allow the use of ordinary
// function as Group mutator.
type GroupFunc func(context.Context, *ent.GroupMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f GroupFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
mv, ok := m.(*ent.GroupMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.GroupMutation", m)
}
return f(ctx, mv)
}
// The ItemFunc type is an adapter to allow the use of ordinary
// function as Item mutator.
type ItemFunc func(context.Context, *ent.ItemMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f ItemFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
mv, ok := m.(*ent.ItemMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ItemMutation", m)
}
return f(ctx, mv)
}
// The ItemFieldFunc type is an adapter to allow the use of ordinary
// function as ItemField mutator.
type ItemFieldFunc func(context.Context, *ent.ItemFieldMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f ItemFieldFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
mv, ok := m.(*ent.ItemFieldMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ItemFieldMutation", m)
}
return f(ctx, mv)
}
// The LabelFunc type is an adapter to allow the use of ordinary
// function as Label mutator.
type LabelFunc func(context.Context, *ent.LabelMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f LabelFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
mv, ok := m.(*ent.LabelMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.LabelMutation", m)
}
return f(ctx, mv)
}
// The LocationFunc type is an adapter to allow the use of ordinary
// function as Location mutator.
type LocationFunc func(context.Context, *ent.LocationMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f LocationFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
mv, ok := m.(*ent.LocationMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.LocationMutation", m)
}
return f(ctx, mv)
}
// The UserFunc type is an adapter to allow the use of ordinary
// function as User mutator.
type UserFunc func(context.Context, *ent.UserMutation) (ent.Value, error)
@ -130,7 +195,6 @@ func HasFields(field string, fields ...string) Condition {
// If executes the given hook under condition.
//
// hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))
//
func If(hk ent.Hook, cond Condition) ent.Hook {
return func(next ent.Mutator) ent.Mutator {
return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {
@ -145,7 +209,6 @@ func If(hk ent.Hook, cond Condition) ent.Hook {
// On executes the given hook only for the given operation.
//
// hook.On(Log, ent.Delete|ent.Create)
//
func On(hk ent.Hook, op ent.Op) ent.Hook {
return If(hk, HasOp(op))
}
@ -153,7 +216,6 @@ func On(hk ent.Hook, op ent.Op) ent.Hook {
// Unless skips the given hook only for the given operation.
//
// hook.Unless(Log, ent.Update|ent.UpdateOne)
//
func Unless(hk ent.Hook, op ent.Op) ent.Hook {
return If(hk, Not(HasOp(op)))
}
@ -174,7 +236,6 @@ func FixedError(err error) ent.Hook {
// Reject(ent.Delete|ent.Update),
// }
// }
//
func Reject(op ent.Op) ent.Hook {
hk := FixedError(fmt.Errorf("%s operation is not allowed", op))
return On(hk, op)