290 lines
18 KiB
Go
290 lines
18 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"time"
|
|
"tss-rocks-be/ent/category"
|
|
"tss-rocks-be/ent/categorycontent"
|
|
"tss-rocks-be/ent/contributor"
|
|
"tss-rocks-be/ent/contributorrole"
|
|
"tss-rocks-be/ent/contributorsociallink"
|
|
"tss-rocks-be/ent/daily"
|
|
"tss-rocks-be/ent/dailycategory"
|
|
"tss-rocks-be/ent/dailycategorycontent"
|
|
"tss-rocks-be/ent/dailycontent"
|
|
"tss-rocks-be/ent/media"
|
|
"tss-rocks-be/ent/permission"
|
|
"tss-rocks-be/ent/post"
|
|
"tss-rocks-be/ent/postcontent"
|
|
"tss-rocks-be/ent/postcontributor"
|
|
"tss-rocks-be/ent/role"
|
|
"tss-rocks-be/ent/schema"
|
|
"tss-rocks-be/ent/user"
|
|
)
|
|
|
|
// 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() {
|
|
categoryFields := schema.Category{}.Fields()
|
|
_ = categoryFields
|
|
// categoryDescCreatedAt is the schema descriptor for created_at field.
|
|
categoryDescCreatedAt := categoryFields[0].Descriptor()
|
|
// category.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
category.DefaultCreatedAt = categoryDescCreatedAt.Default.(func() time.Time)
|
|
// categoryDescUpdatedAt is the schema descriptor for updated_at field.
|
|
categoryDescUpdatedAt := categoryFields[1].Descriptor()
|
|
// category.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
category.DefaultUpdatedAt = categoryDescUpdatedAt.Default.(func() time.Time)
|
|
// category.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
category.UpdateDefaultUpdatedAt = categoryDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
categorycontentFields := schema.CategoryContent{}.Fields()
|
|
_ = categorycontentFields
|
|
// categorycontentDescName is the schema descriptor for name field.
|
|
categorycontentDescName := categorycontentFields[1].Descriptor()
|
|
// categorycontent.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
categorycontent.NameValidator = categorycontentDescName.Validators[0].(func(string) error)
|
|
// categorycontentDescSlug is the schema descriptor for slug field.
|
|
categorycontentDescSlug := categorycontentFields[3].Descriptor()
|
|
// categorycontent.SlugValidator is a validator for the "slug" field. It is called by the builders before save.
|
|
categorycontent.SlugValidator = categorycontentDescSlug.Validators[0].(func(string) error)
|
|
contributorFields := schema.Contributor{}.Fields()
|
|
_ = contributorFields
|
|
// contributorDescName is the schema descriptor for name field.
|
|
contributorDescName := contributorFields[0].Descriptor()
|
|
// contributor.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
contributor.NameValidator = contributorDescName.Validators[0].(func(string) error)
|
|
// contributorDescCreatedAt is the schema descriptor for created_at field.
|
|
contributorDescCreatedAt := contributorFields[3].Descriptor()
|
|
// contributor.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
contributor.DefaultCreatedAt = contributorDescCreatedAt.Default.(func() time.Time)
|
|
// contributorDescUpdatedAt is the schema descriptor for updated_at field.
|
|
contributorDescUpdatedAt := contributorFields[4].Descriptor()
|
|
// contributor.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
contributor.DefaultUpdatedAt = contributorDescUpdatedAt.Default.(func() time.Time)
|
|
// contributor.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
contributor.UpdateDefaultUpdatedAt = contributorDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
contributorroleFields := schema.ContributorRole{}.Fields()
|
|
_ = contributorroleFields
|
|
// contributorroleDescName is the schema descriptor for name field.
|
|
contributorroleDescName := contributorroleFields[0].Descriptor()
|
|
// contributorrole.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
contributorrole.NameValidator = func() func(string) error {
|
|
validators := contributorroleDescName.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
|
|
}
|
|
}()
|
|
contributorsociallinkFields := schema.ContributorSocialLink{}.Fields()
|
|
_ = contributorsociallinkFields
|
|
// contributorsociallinkDescValue is the schema descriptor for value field.
|
|
contributorsociallinkDescValue := contributorsociallinkFields[2].Descriptor()
|
|
// contributorsociallink.ValueValidator is a validator for the "value" field. It is called by the builders before save.
|
|
contributorsociallink.ValueValidator = contributorsociallinkDescValue.Validators[0].(func(string) error)
|
|
dailyFields := schema.Daily{}.Fields()
|
|
_ = dailyFields
|
|
// dailyDescImageURL is the schema descriptor for image_url field.
|
|
dailyDescImageURL := dailyFields[1].Descriptor()
|
|
// daily.ImageURLValidator is a validator for the "image_url" field. It is called by the builders before save.
|
|
daily.ImageURLValidator = dailyDescImageURL.Validators[0].(func(string) error)
|
|
// dailyDescCreatedAt is the schema descriptor for created_at field.
|
|
dailyDescCreatedAt := dailyFields[2].Descriptor()
|
|
// daily.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
daily.DefaultCreatedAt = dailyDescCreatedAt.Default.(func() time.Time)
|
|
// dailyDescUpdatedAt is the schema descriptor for updated_at field.
|
|
dailyDescUpdatedAt := dailyFields[3].Descriptor()
|
|
// daily.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
daily.DefaultUpdatedAt = dailyDescUpdatedAt.Default.(func() time.Time)
|
|
// daily.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
daily.UpdateDefaultUpdatedAt = dailyDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
// dailyDescID is the schema descriptor for id field.
|
|
dailyDescID := dailyFields[0].Descriptor()
|
|
// daily.IDValidator is a validator for the "id" field. It is called by the builders before save.
|
|
daily.IDValidator = func() func(string) error {
|
|
validators := dailyDescID.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
validators[2].(func(string) error),
|
|
validators[3].(func(string) error),
|
|
}
|
|
return func(id string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(id); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
dailycategoryFields := schema.DailyCategory{}.Fields()
|
|
_ = dailycategoryFields
|
|
// dailycategoryDescCreatedAt is the schema descriptor for created_at field.
|
|
dailycategoryDescCreatedAt := dailycategoryFields[0].Descriptor()
|
|
// dailycategory.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
dailycategory.DefaultCreatedAt = dailycategoryDescCreatedAt.Default.(func() time.Time)
|
|
// dailycategoryDescUpdatedAt is the schema descriptor for updated_at field.
|
|
dailycategoryDescUpdatedAt := dailycategoryFields[1].Descriptor()
|
|
// dailycategory.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
dailycategory.DefaultUpdatedAt = dailycategoryDescUpdatedAt.Default.(func() time.Time)
|
|
// dailycategory.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
dailycategory.UpdateDefaultUpdatedAt = dailycategoryDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
dailycategorycontentFields := schema.DailyCategoryContent{}.Fields()
|
|
_ = dailycategorycontentFields
|
|
// dailycategorycontentDescName is the schema descriptor for name field.
|
|
dailycategorycontentDescName := dailycategorycontentFields[1].Descriptor()
|
|
// dailycategorycontent.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
dailycategorycontent.NameValidator = dailycategorycontentDescName.Validators[0].(func(string) error)
|
|
dailycontentFields := schema.DailyContent{}.Fields()
|
|
_ = dailycontentFields
|
|
// dailycontentDescQuote is the schema descriptor for quote field.
|
|
dailycontentDescQuote := dailycontentFields[1].Descriptor()
|
|
// dailycontent.QuoteValidator is a validator for the "quote" field. It is called by the builders before save.
|
|
dailycontent.QuoteValidator = dailycontentDescQuote.Validators[0].(func(string) error)
|
|
mediaFields := schema.Media{}.Fields()
|
|
_ = mediaFields
|
|
// mediaDescStorageID is the schema descriptor for storage_id field.
|
|
mediaDescStorageID := mediaFields[0].Descriptor()
|
|
// media.StorageIDValidator is a validator for the "storage_id" field. It is called by the builders before save.
|
|
media.StorageIDValidator = mediaDescStorageID.Validators[0].(func(string) error)
|
|
// mediaDescOriginalName is the schema descriptor for original_name field.
|
|
mediaDescOriginalName := mediaFields[1].Descriptor()
|
|
// media.OriginalNameValidator is a validator for the "original_name" field. It is called by the builders before save.
|
|
media.OriginalNameValidator = mediaDescOriginalName.Validators[0].(func(string) error)
|
|
// mediaDescMimeType is the schema descriptor for mime_type field.
|
|
mediaDescMimeType := mediaFields[2].Descriptor()
|
|
// media.MimeTypeValidator is a validator for the "mime_type" field. It is called by the builders before save.
|
|
media.MimeTypeValidator = mediaDescMimeType.Validators[0].(func(string) error)
|
|
// mediaDescSize is the schema descriptor for size field.
|
|
mediaDescSize := mediaFields[3].Descriptor()
|
|
// media.SizeValidator is a validator for the "size" field. It is called by the builders before save.
|
|
media.SizeValidator = mediaDescSize.Validators[0].(func(int64) error)
|
|
// mediaDescURL is the schema descriptor for url field.
|
|
mediaDescURL := mediaFields[4].Descriptor()
|
|
// media.URLValidator is a validator for the "url" field. It is called by the builders before save.
|
|
media.URLValidator = mediaDescURL.Validators[0].(func(string) error)
|
|
// mediaDescCreatedAt is the schema descriptor for created_at field.
|
|
mediaDescCreatedAt := mediaFields[5].Descriptor()
|
|
// media.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
media.DefaultCreatedAt = mediaDescCreatedAt.Default.(func() time.Time)
|
|
// mediaDescUpdatedAt is the schema descriptor for updated_at field.
|
|
mediaDescUpdatedAt := mediaFields[6].Descriptor()
|
|
// media.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
media.DefaultUpdatedAt = mediaDescUpdatedAt.Default.(func() time.Time)
|
|
// media.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
media.UpdateDefaultUpdatedAt = mediaDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
permissionFields := schema.Permission{}.Fields()
|
|
_ = permissionFields
|
|
// permissionDescResource is the schema descriptor for resource field.
|
|
permissionDescResource := permissionFields[0].Descriptor()
|
|
// permission.ResourceValidator is a validator for the "resource" field. It is called by the builders before save.
|
|
permission.ResourceValidator = permissionDescResource.Validators[0].(func(string) error)
|
|
// permissionDescAction is the schema descriptor for action field.
|
|
permissionDescAction := permissionFields[1].Descriptor()
|
|
// permission.ActionValidator is a validator for the "action" field. It is called by the builders before save.
|
|
permission.ActionValidator = permissionDescAction.Validators[0].(func(string) error)
|
|
// permissionDescCreatedAt is the schema descriptor for created_at field.
|
|
permissionDescCreatedAt := permissionFields[3].Descriptor()
|
|
// permission.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
permission.DefaultCreatedAt = permissionDescCreatedAt.Default.(func() time.Time)
|
|
// permissionDescUpdatedAt is the schema descriptor for updated_at field.
|
|
permissionDescUpdatedAt := permissionFields[4].Descriptor()
|
|
// permission.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
permission.DefaultUpdatedAt = permissionDescUpdatedAt.Default.(func() time.Time)
|
|
// permission.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
permission.UpdateDefaultUpdatedAt = permissionDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
postFields := schema.Post{}.Fields()
|
|
_ = postFields
|
|
// postDescSlug is the schema descriptor for slug field.
|
|
postDescSlug := postFields[1].Descriptor()
|
|
// post.SlugValidator is a validator for the "slug" field. It is called by the builders before save.
|
|
post.SlugValidator = postDescSlug.Validators[0].(func(string) error)
|
|
// postDescCreatedAt is the schema descriptor for created_at field.
|
|
postDescCreatedAt := postFields[2].Descriptor()
|
|
// post.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
post.DefaultCreatedAt = postDescCreatedAt.Default.(func() time.Time)
|
|
// postDescUpdatedAt is the schema descriptor for updated_at field.
|
|
postDescUpdatedAt := postFields[3].Descriptor()
|
|
// post.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
post.DefaultUpdatedAt = postDescUpdatedAt.Default.(func() time.Time)
|
|
// post.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
post.UpdateDefaultUpdatedAt = postDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
postcontentFields := schema.PostContent{}.Fields()
|
|
_ = postcontentFields
|
|
// postcontentDescTitle is the schema descriptor for title field.
|
|
postcontentDescTitle := postcontentFields[1].Descriptor()
|
|
// postcontent.TitleValidator is a validator for the "title" field. It is called by the builders before save.
|
|
postcontent.TitleValidator = postcontentDescTitle.Validators[0].(func(string) error)
|
|
// postcontentDescContentMarkdown is the schema descriptor for content_markdown field.
|
|
postcontentDescContentMarkdown := postcontentFields[2].Descriptor()
|
|
// postcontent.ContentMarkdownValidator is a validator for the "content_markdown" field. It is called by the builders before save.
|
|
postcontent.ContentMarkdownValidator = postcontentDescContentMarkdown.Validators[0].(func(string) error)
|
|
// postcontentDescSummary is the schema descriptor for summary field.
|
|
postcontentDescSummary := postcontentFields[3].Descriptor()
|
|
// postcontent.SummaryValidator is a validator for the "summary" field. It is called by the builders before save.
|
|
postcontent.SummaryValidator = postcontentDescSummary.Validators[0].(func(string) error)
|
|
// postcontentDescSlug is the schema descriptor for slug field.
|
|
postcontentDescSlug := postcontentFields[6].Descriptor()
|
|
// postcontent.SlugValidator is a validator for the "slug" field. It is called by the builders before save.
|
|
postcontent.SlugValidator = postcontentDescSlug.Validators[0].(func(string) error)
|
|
postcontributorFields := schema.PostContributor{}.Fields()
|
|
_ = postcontributorFields
|
|
// postcontributorDescCreatedAt is the schema descriptor for created_at field.
|
|
postcontributorDescCreatedAt := postcontributorFields[1].Descriptor()
|
|
// postcontributor.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
postcontributor.DefaultCreatedAt = postcontributorDescCreatedAt.Default.(func() time.Time)
|
|
roleFields := schema.Role{}.Fields()
|
|
_ = roleFields
|
|
// roleDescName is the schema descriptor for name field.
|
|
roleDescName := roleFields[0].Descriptor()
|
|
// role.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
role.NameValidator = roleDescName.Validators[0].(func(string) error)
|
|
// roleDescCreatedAt is the schema descriptor for created_at field.
|
|
roleDescCreatedAt := roleFields[2].Descriptor()
|
|
// role.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
role.DefaultCreatedAt = roleDescCreatedAt.Default.(func() time.Time)
|
|
// roleDescUpdatedAt is the schema descriptor for updated_at field.
|
|
roleDescUpdatedAt := roleFields[3].Descriptor()
|
|
// role.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
role.DefaultUpdatedAt = roleDescUpdatedAt.Default.(func() time.Time)
|
|
// role.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
role.UpdateDefaultUpdatedAt = roleDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
userFields := schema.User{}.Fields()
|
|
_ = userFields
|
|
// userDescUsername is the schema descriptor for username field.
|
|
userDescUsername := userFields[0].Descriptor()
|
|
// user.UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
|
user.UsernameValidator = userDescUsername.Validators[0].(func(string) error)
|
|
// userDescDisplayName is the schema descriptor for display_name field.
|
|
userDescDisplayName := userFields[1].Descriptor()
|
|
// user.DisplayNameValidator is a validator for the "display_name" field. It is called by the builders before save.
|
|
user.DisplayNameValidator = userDescDisplayName.Validators[0].(func(string) error)
|
|
// userDescEmail is the schema descriptor for email field.
|
|
userDescEmail := userFields[2].Descriptor()
|
|
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
|
|
user.EmailValidator = userDescEmail.Validators[0].(func(string) error)
|
|
// userDescPasswordHash is the schema descriptor for password_hash field.
|
|
userDescPasswordHash := userFields[3].Descriptor()
|
|
// user.PasswordHashValidator is a validator for the "password_hash" field. It is called by the builders before save.
|
|
user.PasswordHashValidator = userDescPasswordHash.Validators[0].(func(string) error)
|
|
// userDescCreatedAt is the schema descriptor for created_at field.
|
|
userDescCreatedAt := userFields[5].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 := userFields[6].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)
|
|
}
|