mirror of
https://github.com/versia-pub/versia-go.git
synced 2025-12-06 14:28:20 +01:00
232 lines
14 KiB
Go
232 lines
14 KiB
Go
|
|
// Code generated by ent, DO NOT EDIT.
|
||
|
|
|
||
|
|
package ent
|
||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/google/uuid"
|
||
|
|
"github.com/lysand-org/versia-go/ent/attachment"
|
||
|
|
"github.com/lysand-org/versia-go/ent/follow"
|
||
|
|
"github.com/lysand-org/versia-go/ent/note"
|
||
|
|
"github.com/lysand-org/versia-go/ent/schema"
|
||
|
|
"github.com/lysand-org/versia-go/ent/servermetadata"
|
||
|
|
"github.com/lysand-org/versia-go/ent/user"
|
||
|
|
"github.com/lysand-org/versia-go/pkg/lysand"
|
||
|
|
)
|
||
|
|
|
||
|
|
// 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() {
|
||
|
|
attachmentMixin := schema.Attachment{}.Mixin()
|
||
|
|
attachmentMixinFields0 := attachmentMixin[0].Fields()
|
||
|
|
_ = attachmentMixinFields0
|
||
|
|
attachmentFields := schema.Attachment{}.Fields()
|
||
|
|
_ = attachmentFields
|
||
|
|
// attachmentDescURI is the schema descriptor for uri field.
|
||
|
|
attachmentDescURI := attachmentMixinFields0[2].Descriptor()
|
||
|
|
// attachment.URIValidator is a validator for the "uri" field. It is called by the builders before save.
|
||
|
|
attachment.URIValidator = attachmentDescURI.Validators[0].(func(string) error)
|
||
|
|
// attachmentDescExtensions is the schema descriptor for extensions field.
|
||
|
|
attachmentDescExtensions := attachmentMixinFields0[3].Descriptor()
|
||
|
|
// attachment.DefaultExtensions holds the default value on creation for the extensions field.
|
||
|
|
attachment.DefaultExtensions = attachmentDescExtensions.Default.(lysand.Extensions)
|
||
|
|
// attachmentDescCreatedAt is the schema descriptor for created_at field.
|
||
|
|
attachmentDescCreatedAt := attachmentMixinFields0[4].Descriptor()
|
||
|
|
// attachment.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||
|
|
attachment.DefaultCreatedAt = attachmentDescCreatedAt.Default.(func() time.Time)
|
||
|
|
// attachmentDescUpdatedAt is the schema descriptor for updated_at field.
|
||
|
|
attachmentDescUpdatedAt := attachmentMixinFields0[5].Descriptor()
|
||
|
|
// attachment.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||
|
|
attachment.DefaultUpdatedAt = attachmentDescUpdatedAt.Default.(func() time.Time)
|
||
|
|
// attachment.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
||
|
|
attachment.UpdateDefaultUpdatedAt = attachmentDescUpdatedAt.UpdateDefault.(func() time.Time)
|
||
|
|
// attachmentDescDescription is the schema descriptor for description field.
|
||
|
|
attachmentDescDescription := attachmentFields[0].Descriptor()
|
||
|
|
// attachment.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
|
||
|
|
attachment.DescriptionValidator = attachmentDescDescription.Validators[0].(func(string) error)
|
||
|
|
// attachmentDescID is the schema descriptor for id field.
|
||
|
|
attachmentDescID := attachmentMixinFields0[0].Descriptor()
|
||
|
|
// attachment.DefaultID holds the default value on creation for the id field.
|
||
|
|
attachment.DefaultID = attachmentDescID.Default.(func() uuid.UUID)
|
||
|
|
followMixin := schema.Follow{}.Mixin()
|
||
|
|
followMixinFields0 := followMixin[0].Fields()
|
||
|
|
_ = followMixinFields0
|
||
|
|
followFields := schema.Follow{}.Fields()
|
||
|
|
_ = followFields
|
||
|
|
// followDescURI is the schema descriptor for uri field.
|
||
|
|
followDescURI := followMixinFields0[2].Descriptor()
|
||
|
|
// follow.URIValidator is a validator for the "uri" field. It is called by the builders before save.
|
||
|
|
follow.URIValidator = followDescURI.Validators[0].(func(string) error)
|
||
|
|
// followDescExtensions is the schema descriptor for extensions field.
|
||
|
|
followDescExtensions := followMixinFields0[3].Descriptor()
|
||
|
|
// follow.DefaultExtensions holds the default value on creation for the extensions field.
|
||
|
|
follow.DefaultExtensions = followDescExtensions.Default.(lysand.Extensions)
|
||
|
|
// followDescCreatedAt is the schema descriptor for created_at field.
|
||
|
|
followDescCreatedAt := followMixinFields0[4].Descriptor()
|
||
|
|
// follow.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||
|
|
follow.DefaultCreatedAt = followDescCreatedAt.Default.(func() time.Time)
|
||
|
|
// followDescUpdatedAt is the schema descriptor for updated_at field.
|
||
|
|
followDescUpdatedAt := followMixinFields0[5].Descriptor()
|
||
|
|
// follow.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||
|
|
follow.DefaultUpdatedAt = followDescUpdatedAt.Default.(func() time.Time)
|
||
|
|
// follow.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
||
|
|
follow.UpdateDefaultUpdatedAt = followDescUpdatedAt.UpdateDefault.(func() time.Time)
|
||
|
|
// followDescID is the schema descriptor for id field.
|
||
|
|
followDescID := followMixinFields0[0].Descriptor()
|
||
|
|
// follow.DefaultID holds the default value on creation for the id field.
|
||
|
|
follow.DefaultID = followDescID.Default.(func() uuid.UUID)
|
||
|
|
noteMixin := schema.Note{}.Mixin()
|
||
|
|
noteMixinFields0 := noteMixin[0].Fields()
|
||
|
|
_ = noteMixinFields0
|
||
|
|
noteFields := schema.Note{}.Fields()
|
||
|
|
_ = noteFields
|
||
|
|
// noteDescURI is the schema descriptor for uri field.
|
||
|
|
noteDescURI := noteMixinFields0[2].Descriptor()
|
||
|
|
// note.URIValidator is a validator for the "uri" field. It is called by the builders before save.
|
||
|
|
note.URIValidator = noteDescURI.Validators[0].(func(string) error)
|
||
|
|
// noteDescExtensions is the schema descriptor for extensions field.
|
||
|
|
noteDescExtensions := noteMixinFields0[3].Descriptor()
|
||
|
|
// note.DefaultExtensions holds the default value on creation for the extensions field.
|
||
|
|
note.DefaultExtensions = noteDescExtensions.Default.(lysand.Extensions)
|
||
|
|
// noteDescCreatedAt is the schema descriptor for created_at field.
|
||
|
|
noteDescCreatedAt := noteMixinFields0[4].Descriptor()
|
||
|
|
// note.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||
|
|
note.DefaultCreatedAt = noteDescCreatedAt.Default.(func() time.Time)
|
||
|
|
// noteDescUpdatedAt is the schema descriptor for updated_at field.
|
||
|
|
noteDescUpdatedAt := noteMixinFields0[5].Descriptor()
|
||
|
|
// note.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||
|
|
note.DefaultUpdatedAt = noteDescUpdatedAt.Default.(func() time.Time)
|
||
|
|
// note.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
||
|
|
note.UpdateDefaultUpdatedAt = noteDescUpdatedAt.UpdateDefault.(func() time.Time)
|
||
|
|
// noteDescSubject is the schema descriptor for subject field.
|
||
|
|
noteDescSubject := noteFields[0].Descriptor()
|
||
|
|
// note.SubjectValidator is a validator for the "subject" field. It is called by the builders before save.
|
||
|
|
note.SubjectValidator = noteDescSubject.Validators[0].(func(string) error)
|
||
|
|
// noteDescIsSensitive is the schema descriptor for isSensitive field.
|
||
|
|
noteDescIsSensitive := noteFields[2].Descriptor()
|
||
|
|
// note.DefaultIsSensitive holds the default value on creation for the isSensitive field.
|
||
|
|
note.DefaultIsSensitive = noteDescIsSensitive.Default.(bool)
|
||
|
|
// noteDescID is the schema descriptor for id field.
|
||
|
|
noteDescID := noteMixinFields0[0].Descriptor()
|
||
|
|
// note.DefaultID holds the default value on creation for the id field.
|
||
|
|
note.DefaultID = noteDescID.Default.(func() uuid.UUID)
|
||
|
|
servermetadataMixin := schema.ServerMetadata{}.Mixin()
|
||
|
|
servermetadataMixinFields0 := servermetadataMixin[0].Fields()
|
||
|
|
_ = servermetadataMixinFields0
|
||
|
|
servermetadataFields := schema.ServerMetadata{}.Fields()
|
||
|
|
_ = servermetadataFields
|
||
|
|
// servermetadataDescURI is the schema descriptor for uri field.
|
||
|
|
servermetadataDescURI := servermetadataMixinFields0[2].Descriptor()
|
||
|
|
// servermetadata.URIValidator is a validator for the "uri" field. It is called by the builders before save.
|
||
|
|
servermetadata.URIValidator = servermetadataDescURI.Validators[0].(func(string) error)
|
||
|
|
// servermetadataDescExtensions is the schema descriptor for extensions field.
|
||
|
|
servermetadataDescExtensions := servermetadataMixinFields0[3].Descriptor()
|
||
|
|
// servermetadata.DefaultExtensions holds the default value on creation for the extensions field.
|
||
|
|
servermetadata.DefaultExtensions = servermetadataDescExtensions.Default.(lysand.Extensions)
|
||
|
|
// servermetadataDescCreatedAt is the schema descriptor for created_at field.
|
||
|
|
servermetadataDescCreatedAt := servermetadataMixinFields0[4].Descriptor()
|
||
|
|
// servermetadata.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||
|
|
servermetadata.DefaultCreatedAt = servermetadataDescCreatedAt.Default.(func() time.Time)
|
||
|
|
// servermetadataDescUpdatedAt is the schema descriptor for updated_at field.
|
||
|
|
servermetadataDescUpdatedAt := servermetadataMixinFields0[5].Descriptor()
|
||
|
|
// servermetadata.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||
|
|
servermetadata.DefaultUpdatedAt = servermetadataDescUpdatedAt.Default.(func() time.Time)
|
||
|
|
// servermetadata.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
||
|
|
servermetadata.UpdateDefaultUpdatedAt = servermetadataDescUpdatedAt.UpdateDefault.(func() time.Time)
|
||
|
|
// servermetadataDescName is the schema descriptor for name field.
|
||
|
|
servermetadataDescName := servermetadataFields[0].Descriptor()
|
||
|
|
// servermetadata.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
||
|
|
servermetadata.NameValidator = servermetadataDescName.Validators[0].(func(string) error)
|
||
|
|
// servermetadataDescVersion is the schema descriptor for version field.
|
||
|
|
servermetadataDescVersion := servermetadataFields[2].Descriptor()
|
||
|
|
// servermetadata.VersionValidator is a validator for the "version" field. It is called by the builders before save.
|
||
|
|
servermetadata.VersionValidator = servermetadataDescVersion.Validators[0].(func(string) error)
|
||
|
|
// servermetadataDescSupportedExtensions is the schema descriptor for supportedExtensions field.
|
||
|
|
servermetadataDescSupportedExtensions := servermetadataFields[3].Descriptor()
|
||
|
|
// servermetadata.DefaultSupportedExtensions holds the default value on creation for the supportedExtensions field.
|
||
|
|
servermetadata.DefaultSupportedExtensions = servermetadataDescSupportedExtensions.Default.([]string)
|
||
|
|
// servermetadataDescID is the schema descriptor for id field.
|
||
|
|
servermetadataDescID := servermetadataMixinFields0[0].Descriptor()
|
||
|
|
// servermetadata.DefaultID holds the default value on creation for the id field.
|
||
|
|
servermetadata.DefaultID = servermetadataDescID.Default.(func() uuid.UUID)
|
||
|
|
userMixin := schema.User{}.Mixin()
|
||
|
|
userMixinFields0 := userMixin[0].Fields()
|
||
|
|
_ = userMixinFields0
|
||
|
|
userFields := schema.User{}.Fields()
|
||
|
|
_ = userFields
|
||
|
|
// userDescURI is the schema descriptor for uri field.
|
||
|
|
userDescURI := userMixinFields0[2].Descriptor()
|
||
|
|
// user.URIValidator is a validator for the "uri" field. It is called by the builders before save.
|
||
|
|
user.URIValidator = userDescURI.Validators[0].(func(string) error)
|
||
|
|
// userDescExtensions is the schema descriptor for extensions field.
|
||
|
|
userDescExtensions := userMixinFields0[3].Descriptor()
|
||
|
|
// user.DefaultExtensions holds the default value on creation for the extensions field.
|
||
|
|
user.DefaultExtensions = userDescExtensions.Default.(lysand.Extensions)
|
||
|
|
// userDescCreatedAt is the schema descriptor for created_at field.
|
||
|
|
userDescCreatedAt := userMixinFields0[4].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[5].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)
|
||
|
|
// 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 = func() func(string) error {
|
||
|
|
validators := userDescUsername.Validators
|
||
|
|
fns := [...]func(string) error{
|
||
|
|
validators[0].(func(string) error),
|
||
|
|
validators[1].(func(string) error),
|
||
|
|
}
|
||
|
|
return func(username string) error {
|
||
|
|
for _, fn := range fns {
|
||
|
|
if err := fn(username); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
}()
|
||
|
|
// userDescDisplayName is the schema descriptor for displayName field.
|
||
|
|
userDescDisplayName := userFields[2].Descriptor()
|
||
|
|
// user.DisplayNameValidator is a validator for the "displayName" field. It is called by the builders before save.
|
||
|
|
user.DisplayNameValidator = userDescDisplayName.Validators[0].(func(string) error)
|
||
|
|
// userDescIndexable is the schema descriptor for indexable field.
|
||
|
|
userDescIndexable := userFields[6].Descriptor()
|
||
|
|
// user.DefaultIndexable holds the default value on creation for the indexable field.
|
||
|
|
user.DefaultIndexable = userDescIndexable.Default.(bool)
|
||
|
|
// userDescFields is the schema descriptor for fields field.
|
||
|
|
userDescFields := userFields[8].Descriptor()
|
||
|
|
// user.DefaultFields holds the default value on creation for the fields field.
|
||
|
|
user.DefaultFields = userDescFields.Default.([]lysand.Field)
|
||
|
|
// userDescInbox is the schema descriptor for inbox field.
|
||
|
|
userDescInbox := userFields[9].Descriptor()
|
||
|
|
// user.InboxValidator is a validator for the "inbox" field. It is called by the builders before save.
|
||
|
|
user.InboxValidator = userDescInbox.Validators[0].(func(string) error)
|
||
|
|
// userDescFeatured is the schema descriptor for featured field.
|
||
|
|
userDescFeatured := userFields[10].Descriptor()
|
||
|
|
// user.FeaturedValidator is a validator for the "featured" field. It is called by the builders before save.
|
||
|
|
user.FeaturedValidator = userDescFeatured.Validators[0].(func(string) error)
|
||
|
|
// userDescFollowers is the schema descriptor for followers field.
|
||
|
|
userDescFollowers := userFields[11].Descriptor()
|
||
|
|
// user.FollowersValidator is a validator for the "followers" field. It is called by the builders before save.
|
||
|
|
user.FollowersValidator = userDescFollowers.Validators[0].(func(string) error)
|
||
|
|
// userDescFollowing is the schema descriptor for following field.
|
||
|
|
userDescFollowing := userFields[12].Descriptor()
|
||
|
|
// user.FollowingValidator is a validator for the "following" field. It is called by the builders before save.
|
||
|
|
user.FollowingValidator = userDescFollowing.Validators[0].(func(string) error)
|
||
|
|
// userDescOutbox is the schema descriptor for outbox field.
|
||
|
|
userDescOutbox := userFields[13].Descriptor()
|
||
|
|
// user.OutboxValidator is a validator for the "outbox" field. It is called by the builders before save.
|
||
|
|
user.OutboxValidator = userDescOutbox.Validators[0].(func(string) error)
|
||
|
|
// userDescID is the schema descriptor for id field.
|
||
|
|
userDescID := userMixinFields0[0].Descriptor()
|
||
|
|
// user.DefaultID holds the default value on creation for the id field.
|
||
|
|
user.DefaultID = userDescID.Default.(func() uuid.UUID)
|
||
|
|
}
|