mirror of
https://github.com/versia-pub/versia-go.git
synced 2025-12-06 06:28:18 +01:00
279 lines
19 KiB
Go
279 lines
19 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/image"
|
|
"github.com/lysand-org/versia-go/ent/instancemetadata"
|
|
"github.com/lysand-org/versia-go/ent/note"
|
|
"github.com/lysand-org/versia-go/ent/schema"
|
|
"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)
|
|
imageFields := schema.Image{}.Fields()
|
|
_ = imageFields
|
|
// imageDescURL is the schema descriptor for url field.
|
|
imageDescURL := imageFields[0].Descriptor()
|
|
// image.URLValidator is a validator for the "url" field. It is called by the builders before save.
|
|
image.URLValidator = imageDescURL.Validators[0].(func(string) error)
|
|
instancemetadataMixin := schema.InstanceMetadata{}.Mixin()
|
|
instancemetadataMixinFields0 := instancemetadataMixin[0].Fields()
|
|
_ = instancemetadataMixinFields0
|
|
instancemetadataFields := schema.InstanceMetadata{}.Fields()
|
|
_ = instancemetadataFields
|
|
// instancemetadataDescURI is the schema descriptor for uri field.
|
|
instancemetadataDescURI := instancemetadataMixinFields0[2].Descriptor()
|
|
// instancemetadata.URIValidator is a validator for the "uri" field. It is called by the builders before save.
|
|
instancemetadata.URIValidator = instancemetadataDescURI.Validators[0].(func(string) error)
|
|
// instancemetadataDescExtensions is the schema descriptor for extensions field.
|
|
instancemetadataDescExtensions := instancemetadataMixinFields0[3].Descriptor()
|
|
// instancemetadata.DefaultExtensions holds the default value on creation for the extensions field.
|
|
instancemetadata.DefaultExtensions = instancemetadataDescExtensions.Default.(lysand.Extensions)
|
|
// instancemetadataDescCreatedAt is the schema descriptor for created_at field.
|
|
instancemetadataDescCreatedAt := instancemetadataMixinFields0[4].Descriptor()
|
|
// instancemetadata.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
instancemetadata.DefaultCreatedAt = instancemetadataDescCreatedAt.Default.(func() time.Time)
|
|
// instancemetadataDescUpdatedAt is the schema descriptor for updated_at field.
|
|
instancemetadataDescUpdatedAt := instancemetadataMixinFields0[5].Descriptor()
|
|
// instancemetadata.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
instancemetadata.DefaultUpdatedAt = instancemetadataDescUpdatedAt.Default.(func() time.Time)
|
|
// instancemetadata.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
instancemetadata.UpdateDefaultUpdatedAt = instancemetadataDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
// instancemetadataDescName is the schema descriptor for name field.
|
|
instancemetadataDescName := instancemetadataFields[0].Descriptor()
|
|
// instancemetadata.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
instancemetadata.NameValidator = instancemetadataDescName.Validators[0].(func(string) error)
|
|
// instancemetadataDescHost is the schema descriptor for host field.
|
|
instancemetadataDescHost := instancemetadataFields[2].Descriptor()
|
|
// instancemetadata.HostValidator is a validator for the "host" field. It is called by the builders before save.
|
|
instancemetadata.HostValidator = instancemetadataDescHost.Validators[0].(func(string) error)
|
|
// instancemetadataDescSoftwareName is the schema descriptor for softwareName field.
|
|
instancemetadataDescSoftwareName := instancemetadataFields[6].Descriptor()
|
|
// instancemetadata.SoftwareNameValidator is a validator for the "softwareName" field. It is called by the builders before save.
|
|
instancemetadata.SoftwareNameValidator = instancemetadataDescSoftwareName.Validators[0].(func(string) error)
|
|
// instancemetadataDescSoftwareVersion is the schema descriptor for softwareVersion field.
|
|
instancemetadataDescSoftwareVersion := instancemetadataFields[7].Descriptor()
|
|
// instancemetadata.SoftwareVersionValidator is a validator for the "softwareVersion" field. It is called by the builders before save.
|
|
instancemetadata.SoftwareVersionValidator = instancemetadataDescSoftwareVersion.Validators[0].(func(string) error)
|
|
// instancemetadataDescSharedInboxURI is the schema descriptor for sharedInboxURI field.
|
|
instancemetadataDescSharedInboxURI := instancemetadataFields[8].Descriptor()
|
|
// instancemetadata.SharedInboxURIValidator is a validator for the "sharedInboxURI" field. It is called by the builders before save.
|
|
instancemetadata.SharedInboxURIValidator = instancemetadataDescSharedInboxURI.Validators[0].(func(string) error)
|
|
// instancemetadataDescModeratorsURI is the schema descriptor for moderatorsURI field.
|
|
instancemetadataDescModeratorsURI := instancemetadataFields[9].Descriptor()
|
|
// instancemetadata.ModeratorsURIValidator is a validator for the "moderatorsURI" field. It is called by the builders before save.
|
|
instancemetadata.ModeratorsURIValidator = instancemetadataDescModeratorsURI.Validators[0].(func(string) error)
|
|
// instancemetadataDescAdminsURI is the schema descriptor for adminsURI field.
|
|
instancemetadataDescAdminsURI := instancemetadataFields[10].Descriptor()
|
|
// instancemetadata.AdminsURIValidator is a validator for the "adminsURI" field. It is called by the builders before save.
|
|
instancemetadata.AdminsURIValidator = instancemetadataDescAdminsURI.Validators[0].(func(string) error)
|
|
// instancemetadataDescLogoEndpoint is the schema descriptor for logoEndpoint field.
|
|
instancemetadataDescLogoEndpoint := instancemetadataFields[11].Descriptor()
|
|
// instancemetadata.LogoEndpointValidator is a validator for the "logoEndpoint" field. It is called by the builders before save.
|
|
instancemetadata.LogoEndpointValidator = instancemetadataDescLogoEndpoint.Validators[0].(func(string) error)
|
|
// instancemetadataDescLogoMimeType is the schema descriptor for logoMimeType field.
|
|
instancemetadataDescLogoMimeType := instancemetadataFields[12].Descriptor()
|
|
// instancemetadata.LogoMimeTypeValidator is a validator for the "logoMimeType" field. It is called by the builders before save.
|
|
instancemetadata.LogoMimeTypeValidator = instancemetadataDescLogoMimeType.Validators[0].(func(string) error)
|
|
// instancemetadataDescBannerEndpoint is the schema descriptor for bannerEndpoint field.
|
|
instancemetadataDescBannerEndpoint := instancemetadataFields[13].Descriptor()
|
|
// instancemetadata.BannerEndpointValidator is a validator for the "bannerEndpoint" field. It is called by the builders before save.
|
|
instancemetadata.BannerEndpointValidator = instancemetadataDescBannerEndpoint.Validators[0].(func(string) error)
|
|
// instancemetadataDescBannerMimeType is the schema descriptor for bannerMimeType field.
|
|
instancemetadataDescBannerMimeType := instancemetadataFields[14].Descriptor()
|
|
// instancemetadata.BannerMimeTypeValidator is a validator for the "bannerMimeType" field. It is called by the builders before save.
|
|
instancemetadata.BannerMimeTypeValidator = instancemetadataDescBannerMimeType.Validators[0].(func(string) error)
|
|
// instancemetadataDescSupportedVersions is the schema descriptor for supportedVersions field.
|
|
instancemetadataDescSupportedVersions := instancemetadataFields[15].Descriptor()
|
|
// instancemetadata.DefaultSupportedVersions holds the default value on creation for the supportedVersions field.
|
|
instancemetadata.DefaultSupportedVersions = instancemetadataDescSupportedVersions.Default.([]string)
|
|
// instancemetadataDescSupportedExtensions is the schema descriptor for supportedExtensions field.
|
|
instancemetadataDescSupportedExtensions := instancemetadataFields[16].Descriptor()
|
|
// instancemetadata.DefaultSupportedExtensions holds the default value on creation for the supportedExtensions field.
|
|
instancemetadata.DefaultSupportedExtensions = instancemetadataDescSupportedExtensions.Default.([]string)
|
|
// instancemetadataDescID is the schema descriptor for id field.
|
|
instancemetadataDescID := instancemetadataMixinFields0[0].Descriptor()
|
|
// instancemetadata.DefaultID holds the default value on creation for the id field.
|
|
instancemetadata.DefaultID = instancemetadataDescID.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)
|
|
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[8].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[10].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[11].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[12].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[13].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[14].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[15].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)
|
|
}
|