2022-08-30 18:04:50 +00:00
|
|
|
// Code generated by ent, DO NOT EDIT.
|
2022-08-30 02:30:36 +00:00
|
|
|
|
|
|
|
package ent
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
2022-08-30 02:40:54 +00:00
|
|
|
"github.com/hay-kot/content/backend/ent/authtokens"
|
2022-08-30 18:04:50 +00:00
|
|
|
"github.com/hay-kot/content/backend/ent/group"
|
|
|
|
"github.com/hay-kot/content/backend/ent/item"
|
|
|
|
"github.com/hay-kot/content/backend/ent/itemfield"
|
|
|
|
"github.com/hay-kot/content/backend/ent/label"
|
|
|
|
"github.com/hay-kot/content/backend/ent/location"
|
2022-08-30 02:40:54 +00:00
|
|
|
"github.com/hay-kot/content/backend/ent/schema"
|
|
|
|
"github.com/hay-kot/content/backend/ent/user"
|
2022-08-30 02:30:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// The init function reads all schema descriptors with runtime code
|
|
|
|
// (default values, validators, hooks and policies) and stitches it
|
|
|
|
// to their package variables.
|
|
|
|
func init() {
|
2022-08-30 18:04:50 +00:00
|
|
|
authtokensMixin := schema.AuthTokens{}.Mixin()
|
|
|
|
authtokensMixinFields0 := authtokensMixin[0].Fields()
|
|
|
|
_ = authtokensMixinFields0
|
2022-08-30 02:30:36 +00:00
|
|
|
authtokensFields := schema.AuthTokens{}.Fields()
|
|
|
|
_ = authtokensFields
|
2022-08-30 18:04:50 +00:00
|
|
|
// authtokensDescCreatedAt is the schema descriptor for created_at field.
|
|
|
|
authtokensDescCreatedAt := authtokensMixinFields0[1].Descriptor()
|
|
|
|
// authtokens.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
authtokens.DefaultCreatedAt = authtokensDescCreatedAt.Default.(func() time.Time)
|
|
|
|
// authtokensDescUpdatedAt is the schema descriptor for updated_at field.
|
|
|
|
authtokensDescUpdatedAt := authtokensMixinFields0[2].Descriptor()
|
|
|
|
// authtokens.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
|
|
authtokens.DefaultUpdatedAt = authtokensDescUpdatedAt.Default.(func() time.Time)
|
|
|
|
// authtokens.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
|
|
authtokens.UpdateDefaultUpdatedAt = authtokensDescUpdatedAt.UpdateDefault.(func() time.Time)
|
2022-08-30 02:30:36 +00:00
|
|
|
// authtokensDescExpiresAt is the schema descriptor for expires_at field.
|
|
|
|
authtokensDescExpiresAt := authtokensFields[1].Descriptor()
|
|
|
|
// authtokens.DefaultExpiresAt holds the default value on creation for the expires_at field.
|
|
|
|
authtokens.DefaultExpiresAt = authtokensDescExpiresAt.Default.(func() time.Time)
|
2022-08-30 18:04:50 +00:00
|
|
|
// authtokensDescID is the schema descriptor for id field.
|
|
|
|
authtokensDescID := authtokensMixinFields0[0].Descriptor()
|
|
|
|
// authtokens.DefaultID holds the default value on creation for the id field.
|
|
|
|
authtokens.DefaultID = authtokensDescID.Default.(func() uuid.UUID)
|
|
|
|
groupMixin := schema.Group{}.Mixin()
|
|
|
|
groupMixinFields0 := groupMixin[0].Fields()
|
|
|
|
_ = groupMixinFields0
|
|
|
|
groupFields := schema.Group{}.Fields()
|
|
|
|
_ = groupFields
|
|
|
|
// groupDescCreatedAt is the schema descriptor for created_at field.
|
|
|
|
groupDescCreatedAt := groupMixinFields0[1].Descriptor()
|
|
|
|
// group.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
group.DefaultCreatedAt = groupDescCreatedAt.Default.(func() time.Time)
|
|
|
|
// groupDescUpdatedAt is the schema descriptor for updated_at field.
|
|
|
|
groupDescUpdatedAt := groupMixinFields0[2].Descriptor()
|
|
|
|
// group.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
|
|
group.DefaultUpdatedAt = groupDescUpdatedAt.Default.(func() time.Time)
|
|
|
|
// group.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
|
|
group.UpdateDefaultUpdatedAt = groupDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
|
|
// groupDescName is the schema descriptor for name field.
|
|
|
|
groupDescName := groupFields[0].Descriptor()
|
|
|
|
// group.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
|
|
group.NameValidator = func() func(string) error {
|
|
|
|
validators := groupDescName.Validators
|
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
|
|
|
return func(name string) error {
|
|
|
|
for _, fn := range fns {
|
|
|
|
if err := fn(name); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
// groupDescID is the schema descriptor for id field.
|
|
|
|
groupDescID := groupMixinFields0[0].Descriptor()
|
|
|
|
// group.DefaultID holds the default value on creation for the id field.
|
|
|
|
group.DefaultID = groupDescID.Default.(func() uuid.UUID)
|
|
|
|
itemMixin := schema.Item{}.Mixin()
|
|
|
|
itemMixinFields0 := itemMixin[0].Fields()
|
|
|
|
_ = itemMixinFields0
|
|
|
|
itemMixinFields1 := itemMixin[1].Fields()
|
|
|
|
_ = itemMixinFields1
|
|
|
|
itemFields := schema.Item{}.Fields()
|
|
|
|
_ = itemFields
|
|
|
|
// itemDescCreatedAt is the schema descriptor for created_at field.
|
|
|
|
itemDescCreatedAt := itemMixinFields0[1].Descriptor()
|
|
|
|
// item.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
item.DefaultCreatedAt = itemDescCreatedAt.Default.(func() time.Time)
|
|
|
|
// itemDescUpdatedAt is the schema descriptor for updated_at field.
|
|
|
|
itemDescUpdatedAt := itemMixinFields0[2].Descriptor()
|
|
|
|
// item.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
|
|
item.DefaultUpdatedAt = itemDescUpdatedAt.Default.(func() time.Time)
|
|
|
|
// item.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
|
|
item.UpdateDefaultUpdatedAt = itemDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
|
|
// itemDescName is the schema descriptor for name field.
|
|
|
|
itemDescName := itemMixinFields1[0].Descriptor()
|
|
|
|
// item.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
|
|
item.NameValidator = func() func(string) error {
|
|
|
|
validators := itemDescName.Validators
|
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
|
|
|
return func(name string) error {
|
|
|
|
for _, fn := range fns {
|
|
|
|
if err := fn(name); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
// itemDescDescription is the schema descriptor for description field.
|
|
|
|
itemDescDescription := itemMixinFields1[1].Descriptor()
|
|
|
|
// item.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
|
|
|
|
item.DescriptionValidator = itemDescDescription.Validators[0].(func(string) error)
|
|
|
|
// itemDescNotes is the schema descriptor for notes field.
|
|
|
|
itemDescNotes := itemFields[0].Descriptor()
|
|
|
|
// item.NotesValidator is a validator for the "notes" field. It is called by the builders before save.
|
|
|
|
item.NotesValidator = itemDescNotes.Validators[0].(func(string) error)
|
|
|
|
// itemDescSerialNumber is the schema descriptor for serial_number field.
|
|
|
|
itemDescSerialNumber := itemFields[1].Descriptor()
|
|
|
|
// item.SerialNumberValidator is a validator for the "serial_number" field. It is called by the builders before save.
|
|
|
|
item.SerialNumberValidator = itemDescSerialNumber.Validators[0].(func(string) error)
|
|
|
|
// itemDescModelNumber is the schema descriptor for model_number field.
|
|
|
|
itemDescModelNumber := itemFields[2].Descriptor()
|
|
|
|
// item.ModelNumberValidator is a validator for the "model_number" field. It is called by the builders before save.
|
|
|
|
item.ModelNumberValidator = itemDescModelNumber.Validators[0].(func(string) error)
|
|
|
|
// itemDescManufacturer is the schema descriptor for manufacturer field.
|
|
|
|
itemDescManufacturer := itemFields[3].Descriptor()
|
|
|
|
// item.ManufacturerValidator is a validator for the "manufacturer" field. It is called by the builders before save.
|
|
|
|
item.ManufacturerValidator = itemDescManufacturer.Validators[0].(func(string) error)
|
|
|
|
// itemDescPurchasePrice is the schema descriptor for purchase_price field.
|
|
|
|
itemDescPurchasePrice := itemFields[6].Descriptor()
|
|
|
|
// item.DefaultPurchasePrice holds the default value on creation for the purchase_price field.
|
|
|
|
item.DefaultPurchasePrice = itemDescPurchasePrice.Default.(float64)
|
|
|
|
// itemDescSoldPrice is the schema descriptor for sold_price field.
|
|
|
|
itemDescSoldPrice := itemFields[10].Descriptor()
|
|
|
|
// item.DefaultSoldPrice holds the default value on creation for the sold_price field.
|
|
|
|
item.DefaultSoldPrice = itemDescSoldPrice.Default.(float64)
|
|
|
|
// itemDescSoldNotes is the schema descriptor for sold_notes field.
|
|
|
|
itemDescSoldNotes := itemFields[12].Descriptor()
|
|
|
|
// item.SoldNotesValidator is a validator for the "sold_notes" field. It is called by the builders before save.
|
|
|
|
item.SoldNotesValidator = itemDescSoldNotes.Validators[0].(func(string) error)
|
|
|
|
// itemDescID is the schema descriptor for id field.
|
|
|
|
itemDescID := itemMixinFields0[0].Descriptor()
|
|
|
|
// item.DefaultID holds the default value on creation for the id field.
|
|
|
|
item.DefaultID = itemDescID.Default.(func() uuid.UUID)
|
|
|
|
itemfieldMixin := schema.ItemField{}.Mixin()
|
|
|
|
itemfieldMixinFields0 := itemfieldMixin[0].Fields()
|
|
|
|
_ = itemfieldMixinFields0
|
|
|
|
itemfieldMixinFields1 := itemfieldMixin[1].Fields()
|
|
|
|
_ = itemfieldMixinFields1
|
|
|
|
itemfieldFields := schema.ItemField{}.Fields()
|
|
|
|
_ = itemfieldFields
|
|
|
|
// itemfieldDescCreatedAt is the schema descriptor for created_at field.
|
|
|
|
itemfieldDescCreatedAt := itemfieldMixinFields0[1].Descriptor()
|
|
|
|
// itemfield.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
itemfield.DefaultCreatedAt = itemfieldDescCreatedAt.Default.(func() time.Time)
|
|
|
|
// itemfieldDescUpdatedAt is the schema descriptor for updated_at field.
|
|
|
|
itemfieldDescUpdatedAt := itemfieldMixinFields0[2].Descriptor()
|
|
|
|
// itemfield.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
|
|
itemfield.DefaultUpdatedAt = itemfieldDescUpdatedAt.Default.(func() time.Time)
|
|
|
|
// itemfield.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
|
|
itemfield.UpdateDefaultUpdatedAt = itemfieldDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
|
|
// itemfieldDescName is the schema descriptor for name field.
|
|
|
|
itemfieldDescName := itemfieldMixinFields1[0].Descriptor()
|
|
|
|
// itemfield.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
|
|
itemfield.NameValidator = func() func(string) error {
|
|
|
|
validators := itemfieldDescName.Validators
|
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
|
|
|
return func(name string) error {
|
|
|
|
for _, fn := range fns {
|
|
|
|
if err := fn(name); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
// itemfieldDescDescription is the schema descriptor for description field.
|
|
|
|
itemfieldDescDescription := itemfieldMixinFields1[1].Descriptor()
|
|
|
|
// itemfield.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
|
|
|
|
itemfield.DescriptionValidator = itemfieldDescDescription.Validators[0].(func(string) error)
|
|
|
|
// itemfieldDescTextValue is the schema descriptor for text_value field.
|
|
|
|
itemfieldDescTextValue := itemfieldFields[1].Descriptor()
|
|
|
|
// itemfield.TextValueValidator is a validator for the "text_value" field. It is called by the builders before save.
|
|
|
|
itemfield.TextValueValidator = itemfieldDescTextValue.Validators[0].(func(string) error)
|
|
|
|
// itemfieldDescBooleanValue is the schema descriptor for boolean_value field.
|
|
|
|
itemfieldDescBooleanValue := itemfieldFields[3].Descriptor()
|
|
|
|
// itemfield.DefaultBooleanValue holds the default value on creation for the boolean_value field.
|
|
|
|
itemfield.DefaultBooleanValue = itemfieldDescBooleanValue.Default.(bool)
|
|
|
|
// itemfieldDescTimeValue is the schema descriptor for time_value field.
|
|
|
|
itemfieldDescTimeValue := itemfieldFields[4].Descriptor()
|
|
|
|
// itemfield.DefaultTimeValue holds the default value on creation for the time_value field.
|
|
|
|
itemfield.DefaultTimeValue = itemfieldDescTimeValue.Default.(func() time.Time)
|
|
|
|
// itemfieldDescID is the schema descriptor for id field.
|
|
|
|
itemfieldDescID := itemfieldMixinFields0[0].Descriptor()
|
|
|
|
// itemfield.DefaultID holds the default value on creation for the id field.
|
|
|
|
itemfield.DefaultID = itemfieldDescID.Default.(func() uuid.UUID)
|
|
|
|
labelMixin := schema.Label{}.Mixin()
|
|
|
|
labelMixinFields0 := labelMixin[0].Fields()
|
|
|
|
_ = labelMixinFields0
|
|
|
|
labelMixinFields1 := labelMixin[1].Fields()
|
|
|
|
_ = labelMixinFields1
|
|
|
|
labelFields := schema.Label{}.Fields()
|
|
|
|
_ = labelFields
|
|
|
|
// labelDescCreatedAt is the schema descriptor for created_at field.
|
|
|
|
labelDescCreatedAt := labelMixinFields0[1].Descriptor()
|
|
|
|
// label.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
label.DefaultCreatedAt = labelDescCreatedAt.Default.(func() time.Time)
|
|
|
|
// labelDescUpdatedAt is the schema descriptor for updated_at field.
|
|
|
|
labelDescUpdatedAt := labelMixinFields0[2].Descriptor()
|
|
|
|
// label.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
|
|
label.DefaultUpdatedAt = labelDescUpdatedAt.Default.(func() time.Time)
|
|
|
|
// label.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
|
|
label.UpdateDefaultUpdatedAt = labelDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
|
|
// labelDescName is the schema descriptor for name field.
|
|
|
|
labelDescName := labelMixinFields1[0].Descriptor()
|
|
|
|
// label.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
|
|
label.NameValidator = func() func(string) error {
|
|
|
|
validators := labelDescName.Validators
|
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
|
|
|
return func(name string) error {
|
|
|
|
for _, fn := range fns {
|
|
|
|
if err := fn(name); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
// labelDescDescription is the schema descriptor for description field.
|
|
|
|
labelDescDescription := labelMixinFields1[1].Descriptor()
|
|
|
|
// label.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
|
|
|
|
label.DescriptionValidator = labelDescDescription.Validators[0].(func(string) error)
|
|
|
|
// labelDescColor is the schema descriptor for color field.
|
|
|
|
labelDescColor := labelFields[0].Descriptor()
|
|
|
|
// label.ColorValidator is a validator for the "color" field. It is called by the builders before save.
|
|
|
|
label.ColorValidator = labelDescColor.Validators[0].(func(string) error)
|
|
|
|
// labelDescID is the schema descriptor for id field.
|
|
|
|
labelDescID := labelMixinFields0[0].Descriptor()
|
|
|
|
// label.DefaultID holds the default value on creation for the id field.
|
|
|
|
label.DefaultID = labelDescID.Default.(func() uuid.UUID)
|
|
|
|
locationMixin := schema.Location{}.Mixin()
|
|
|
|
locationMixinFields0 := locationMixin[0].Fields()
|
|
|
|
_ = locationMixinFields0
|
|
|
|
locationMixinFields1 := locationMixin[1].Fields()
|
|
|
|
_ = locationMixinFields1
|
|
|
|
locationFields := schema.Location{}.Fields()
|
|
|
|
_ = locationFields
|
|
|
|
// locationDescCreatedAt is the schema descriptor for created_at field.
|
|
|
|
locationDescCreatedAt := locationMixinFields0[1].Descriptor()
|
|
|
|
// location.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
location.DefaultCreatedAt = locationDescCreatedAt.Default.(func() time.Time)
|
|
|
|
// locationDescUpdatedAt is the schema descriptor for updated_at field.
|
|
|
|
locationDescUpdatedAt := locationMixinFields0[2].Descriptor()
|
|
|
|
// location.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
|
|
location.DefaultUpdatedAt = locationDescUpdatedAt.Default.(func() time.Time)
|
|
|
|
// location.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
|
|
location.UpdateDefaultUpdatedAt = locationDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
|
|
// locationDescName is the schema descriptor for name field.
|
|
|
|
locationDescName := locationMixinFields1[0].Descriptor()
|
|
|
|
// location.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
|
|
location.NameValidator = func() func(string) error {
|
|
|
|
validators := locationDescName.Validators
|
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
|
|
|
return func(name string) error {
|
|
|
|
for _, fn := range fns {
|
|
|
|
if err := fn(name); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
// locationDescDescription is the schema descriptor for description field.
|
|
|
|
locationDescDescription := locationMixinFields1[1].Descriptor()
|
|
|
|
// location.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
|
|
|
|
location.DescriptionValidator = locationDescDescription.Validators[0].(func(string) error)
|
|
|
|
// locationDescID is the schema descriptor for id field.
|
|
|
|
locationDescID := locationMixinFields0[0].Descriptor()
|
|
|
|
// location.DefaultID holds the default value on creation for the id field.
|
|
|
|
location.DefaultID = locationDescID.Default.(func() uuid.UUID)
|
|
|
|
userMixin := schema.User{}.Mixin()
|
|
|
|
userMixinFields0 := userMixin[0].Fields()
|
|
|
|
_ = userMixinFields0
|
2022-08-30 02:30:36 +00:00
|
|
|
userFields := schema.User{}.Fields()
|
|
|
|
_ = userFields
|
2022-08-30 18:04:50 +00:00
|
|
|
// userDescCreatedAt is the schema descriptor for created_at field.
|
|
|
|
userDescCreatedAt := userMixinFields0[1].Descriptor()
|
|
|
|
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
|
|
|
|
// userDescUpdatedAt is the schema descriptor for updated_at field.
|
|
|
|
userDescUpdatedAt := userMixinFields0[2].Descriptor()
|
|
|
|
// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
|
|
user.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)
|
|
|
|
// user.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
|
|
user.UpdateDefaultUpdatedAt = userDescUpdatedAt.UpdateDefault.(func() time.Time)
|
2022-08-30 02:30:36 +00:00
|
|
|
// userDescName is the schema descriptor for name field.
|
2022-08-30 18:04:50 +00:00
|
|
|
userDescName := userFields[0].Descriptor()
|
2022-08-30 02:30:36 +00:00
|
|
|
// user.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
2022-08-30 18:04:50 +00:00
|
|
|
user.NameValidator = func() func(string) error {
|
|
|
|
validators := userDescName.Validators
|
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
|
|
|
return func(name string) error {
|
|
|
|
for _, fn := range fns {
|
|
|
|
if err := fn(name); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
2022-08-30 02:30:36 +00:00
|
|
|
// userDescEmail is the schema descriptor for email field.
|
2022-08-30 18:04:50 +00:00
|
|
|
userDescEmail := userFields[1].Descriptor()
|
2022-08-30 02:30:36 +00:00
|
|
|
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
|
2022-08-30 18:04:50 +00:00
|
|
|
user.EmailValidator = func() func(string) error {
|
|
|
|
validators := userDescEmail.Validators
|
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
|
|
|
return func(email string) error {
|
|
|
|
for _, fn := range fns {
|
|
|
|
if err := fn(email); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
2022-08-30 02:30:36 +00:00
|
|
|
// userDescPassword is the schema descriptor for password field.
|
2022-08-30 18:04:50 +00:00
|
|
|
userDescPassword := userFields[2].Descriptor()
|
2022-08-30 02:30:36 +00:00
|
|
|
// user.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
2022-08-30 18:04:50 +00:00
|
|
|
user.PasswordValidator = func() func(string) error {
|
|
|
|
validators := userDescPassword.Validators
|
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
|
|
|
return func(password string) error {
|
|
|
|
for _, fn := range fns {
|
|
|
|
if err := fn(password); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
2022-08-30 02:30:36 +00:00
|
|
|
// userDescIsSuperuser is the schema descriptor for is_superuser field.
|
2022-08-30 18:04:50 +00:00
|
|
|
userDescIsSuperuser := userFields[3].Descriptor()
|
2022-08-30 02:30:36 +00:00
|
|
|
// user.DefaultIsSuperuser holds the default value on creation for the is_superuser field.
|
|
|
|
user.DefaultIsSuperuser = userDescIsSuperuser.Default.(bool)
|
|
|
|
// userDescID is the schema descriptor for id field.
|
2022-08-30 18:04:50 +00:00
|
|
|
userDescID := userMixinFields0[0].Descriptor()
|
2022-08-30 02:30:36 +00:00
|
|
|
// user.DefaultID holds the default value on creation for the id field.
|
|
|
|
user.DefaultID = userDescID.Default.(func() uuid.UUID)
|
|
|
|
}
|