将仓储层/基础设施改为 Ent + 原生 SQL 执行路径,并移除 AutoMigrate 与 GORM 依赖。 重构内容包括: - 仓储层改用 Ent/SQL(含 usage_log/account 等复杂查询),统一错误映射 - 基础设施与 setup 初始化切换为 Ent + SQL migrations - 集成测试与 fixtures 迁移到 Ent 事务模型 - 清理遗留 GORM 模型/依赖,补充迁移与文档说明 - 增加根目录 Makefile 便于前后端编译 测试: - go test -tags unit ./... - go test -tags integration ./...
563 lines
29 KiB
Go
563 lines
29 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package runtime
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/Wei-Shaw/sub2api/ent/account"
|
|
"github.com/Wei-Shaw/sub2api/ent/accountgroup"
|
|
"github.com/Wei-Shaw/sub2api/ent/apikey"
|
|
"github.com/Wei-Shaw/sub2api/ent/group"
|
|
"github.com/Wei-Shaw/sub2api/ent/proxy"
|
|
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
|
|
"github.com/Wei-Shaw/sub2api/ent/schema"
|
|
"github.com/Wei-Shaw/sub2api/ent/setting"
|
|
"github.com/Wei-Shaw/sub2api/ent/user"
|
|
"github.com/Wei-Shaw/sub2api/ent/userallowedgroup"
|
|
"github.com/Wei-Shaw/sub2api/ent/usersubscription"
|
|
)
|
|
|
|
// 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() {
|
|
accountMixin := schema.Account{}.Mixin()
|
|
accountMixinHooks1 := accountMixin[1].Hooks()
|
|
account.Hooks[0] = accountMixinHooks1[0]
|
|
accountMixinInters1 := accountMixin[1].Interceptors()
|
|
account.Interceptors[0] = accountMixinInters1[0]
|
|
accountMixinFields0 := accountMixin[0].Fields()
|
|
_ = accountMixinFields0
|
|
accountFields := schema.Account{}.Fields()
|
|
_ = accountFields
|
|
// accountDescCreatedAt is the schema descriptor for created_at field.
|
|
accountDescCreatedAt := accountMixinFields0[0].Descriptor()
|
|
// account.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
account.DefaultCreatedAt = accountDescCreatedAt.Default.(func() time.Time)
|
|
// accountDescUpdatedAt is the schema descriptor for updated_at field.
|
|
accountDescUpdatedAt := accountMixinFields0[1].Descriptor()
|
|
// account.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
account.DefaultUpdatedAt = accountDescUpdatedAt.Default.(func() time.Time)
|
|
// account.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
account.UpdateDefaultUpdatedAt = accountDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
// accountDescName is the schema descriptor for name field.
|
|
accountDescName := accountFields[0].Descriptor()
|
|
// account.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
account.NameValidator = func() func(string) error {
|
|
validators := accountDescName.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
|
|
}
|
|
}()
|
|
// accountDescPlatform is the schema descriptor for platform field.
|
|
accountDescPlatform := accountFields[1].Descriptor()
|
|
// account.PlatformValidator is a validator for the "platform" field. It is called by the builders before save.
|
|
account.PlatformValidator = func() func(string) error {
|
|
validators := accountDescPlatform.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(platform string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(platform); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// accountDescType is the schema descriptor for type field.
|
|
accountDescType := accountFields[2].Descriptor()
|
|
// account.TypeValidator is a validator for the "type" field. It is called by the builders before save.
|
|
account.TypeValidator = func() func(string) error {
|
|
validators := accountDescType.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(_type string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(_type); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// accountDescCredentials is the schema descriptor for credentials field.
|
|
accountDescCredentials := accountFields[3].Descriptor()
|
|
// account.DefaultCredentials holds the default value on creation for the credentials field.
|
|
account.DefaultCredentials = accountDescCredentials.Default.(func() map[string]interface{})
|
|
// accountDescExtra is the schema descriptor for extra field.
|
|
accountDescExtra := accountFields[4].Descriptor()
|
|
// account.DefaultExtra holds the default value on creation for the extra field.
|
|
account.DefaultExtra = accountDescExtra.Default.(func() map[string]interface{})
|
|
// accountDescConcurrency is the schema descriptor for concurrency field.
|
|
accountDescConcurrency := accountFields[6].Descriptor()
|
|
// account.DefaultConcurrency holds the default value on creation for the concurrency field.
|
|
account.DefaultConcurrency = accountDescConcurrency.Default.(int)
|
|
// accountDescPriority is the schema descriptor for priority field.
|
|
accountDescPriority := accountFields[7].Descriptor()
|
|
// account.DefaultPriority holds the default value on creation for the priority field.
|
|
account.DefaultPriority = accountDescPriority.Default.(int)
|
|
// accountDescStatus is the schema descriptor for status field.
|
|
accountDescStatus := accountFields[8].Descriptor()
|
|
// account.DefaultStatus holds the default value on creation for the status field.
|
|
account.DefaultStatus = accountDescStatus.Default.(string)
|
|
// account.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
account.StatusValidator = accountDescStatus.Validators[0].(func(string) error)
|
|
// accountDescSchedulable is the schema descriptor for schedulable field.
|
|
accountDescSchedulable := accountFields[11].Descriptor()
|
|
// account.DefaultSchedulable holds the default value on creation for the schedulable field.
|
|
account.DefaultSchedulable = accountDescSchedulable.Default.(bool)
|
|
// accountDescSessionWindowStatus is the schema descriptor for session_window_status field.
|
|
accountDescSessionWindowStatus := accountFields[17].Descriptor()
|
|
// account.SessionWindowStatusValidator is a validator for the "session_window_status" field. It is called by the builders before save.
|
|
account.SessionWindowStatusValidator = accountDescSessionWindowStatus.Validators[0].(func(string) error)
|
|
accountgroupFields := schema.AccountGroup{}.Fields()
|
|
_ = accountgroupFields
|
|
// accountgroupDescPriority is the schema descriptor for priority field.
|
|
accountgroupDescPriority := accountgroupFields[2].Descriptor()
|
|
// accountgroup.DefaultPriority holds the default value on creation for the priority field.
|
|
accountgroup.DefaultPriority = accountgroupDescPriority.Default.(int)
|
|
// accountgroupDescCreatedAt is the schema descriptor for created_at field.
|
|
accountgroupDescCreatedAt := accountgroupFields[3].Descriptor()
|
|
// accountgroup.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
accountgroup.DefaultCreatedAt = accountgroupDescCreatedAt.Default.(func() time.Time)
|
|
apikeyMixin := schema.ApiKey{}.Mixin()
|
|
apikeyMixinHooks1 := apikeyMixin[1].Hooks()
|
|
apikey.Hooks[0] = apikeyMixinHooks1[0]
|
|
apikeyMixinInters1 := apikeyMixin[1].Interceptors()
|
|
apikey.Interceptors[0] = apikeyMixinInters1[0]
|
|
apikeyMixinFields0 := apikeyMixin[0].Fields()
|
|
_ = apikeyMixinFields0
|
|
apikeyFields := schema.ApiKey{}.Fields()
|
|
_ = apikeyFields
|
|
// apikeyDescCreatedAt is the schema descriptor for created_at field.
|
|
apikeyDescCreatedAt := apikeyMixinFields0[0].Descriptor()
|
|
// apikey.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
apikey.DefaultCreatedAt = apikeyDescCreatedAt.Default.(func() time.Time)
|
|
// apikeyDescUpdatedAt is the schema descriptor for updated_at field.
|
|
apikeyDescUpdatedAt := apikeyMixinFields0[1].Descriptor()
|
|
// apikey.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
apikey.DefaultUpdatedAt = apikeyDescUpdatedAt.Default.(func() time.Time)
|
|
// apikey.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
apikey.UpdateDefaultUpdatedAt = apikeyDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
// apikeyDescKey is the schema descriptor for key field.
|
|
apikeyDescKey := apikeyFields[1].Descriptor()
|
|
// apikey.KeyValidator is a validator for the "key" field. It is called by the builders before save.
|
|
apikey.KeyValidator = func() func(string) error {
|
|
validators := apikeyDescKey.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(key string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(key); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// apikeyDescName is the schema descriptor for name field.
|
|
apikeyDescName := apikeyFields[2].Descriptor()
|
|
// apikey.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
apikey.NameValidator = func() func(string) error {
|
|
validators := apikeyDescName.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
|
|
}
|
|
}()
|
|
// apikeyDescStatus is the schema descriptor for status field.
|
|
apikeyDescStatus := apikeyFields[4].Descriptor()
|
|
// apikey.DefaultStatus holds the default value on creation for the status field.
|
|
apikey.DefaultStatus = apikeyDescStatus.Default.(string)
|
|
// apikey.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
apikey.StatusValidator = apikeyDescStatus.Validators[0].(func(string) error)
|
|
groupMixin := schema.Group{}.Mixin()
|
|
groupMixinHooks1 := groupMixin[1].Hooks()
|
|
group.Hooks[0] = groupMixinHooks1[0]
|
|
groupMixinInters1 := groupMixin[1].Interceptors()
|
|
group.Interceptors[0] = groupMixinInters1[0]
|
|
groupMixinFields0 := groupMixin[0].Fields()
|
|
_ = groupMixinFields0
|
|
groupFields := schema.Group{}.Fields()
|
|
_ = groupFields
|
|
// groupDescCreatedAt is the schema descriptor for created_at field.
|
|
groupDescCreatedAt := groupMixinFields0[0].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[1].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
|
|
}
|
|
}()
|
|
// groupDescRateMultiplier is the schema descriptor for rate_multiplier field.
|
|
groupDescRateMultiplier := groupFields[2].Descriptor()
|
|
// group.DefaultRateMultiplier holds the default value on creation for the rate_multiplier field.
|
|
group.DefaultRateMultiplier = groupDescRateMultiplier.Default.(float64)
|
|
// groupDescIsExclusive is the schema descriptor for is_exclusive field.
|
|
groupDescIsExclusive := groupFields[3].Descriptor()
|
|
// group.DefaultIsExclusive holds the default value on creation for the is_exclusive field.
|
|
group.DefaultIsExclusive = groupDescIsExclusive.Default.(bool)
|
|
// groupDescStatus is the schema descriptor for status field.
|
|
groupDescStatus := groupFields[4].Descriptor()
|
|
// group.DefaultStatus holds the default value on creation for the status field.
|
|
group.DefaultStatus = groupDescStatus.Default.(string)
|
|
// group.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
group.StatusValidator = groupDescStatus.Validators[0].(func(string) error)
|
|
// groupDescPlatform is the schema descriptor for platform field.
|
|
groupDescPlatform := groupFields[5].Descriptor()
|
|
// group.DefaultPlatform holds the default value on creation for the platform field.
|
|
group.DefaultPlatform = groupDescPlatform.Default.(string)
|
|
// group.PlatformValidator is a validator for the "platform" field. It is called by the builders before save.
|
|
group.PlatformValidator = groupDescPlatform.Validators[0].(func(string) error)
|
|
// groupDescSubscriptionType is the schema descriptor for subscription_type field.
|
|
groupDescSubscriptionType := groupFields[6].Descriptor()
|
|
// group.DefaultSubscriptionType holds the default value on creation for the subscription_type field.
|
|
group.DefaultSubscriptionType = groupDescSubscriptionType.Default.(string)
|
|
// group.SubscriptionTypeValidator is a validator for the "subscription_type" field. It is called by the builders before save.
|
|
group.SubscriptionTypeValidator = groupDescSubscriptionType.Validators[0].(func(string) error)
|
|
proxyMixin := schema.Proxy{}.Mixin()
|
|
proxyMixinHooks1 := proxyMixin[1].Hooks()
|
|
proxy.Hooks[0] = proxyMixinHooks1[0]
|
|
proxyMixinInters1 := proxyMixin[1].Interceptors()
|
|
proxy.Interceptors[0] = proxyMixinInters1[0]
|
|
proxyMixinFields0 := proxyMixin[0].Fields()
|
|
_ = proxyMixinFields0
|
|
proxyFields := schema.Proxy{}.Fields()
|
|
_ = proxyFields
|
|
// proxyDescCreatedAt is the schema descriptor for created_at field.
|
|
proxyDescCreatedAt := proxyMixinFields0[0].Descriptor()
|
|
// proxy.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
proxy.DefaultCreatedAt = proxyDescCreatedAt.Default.(func() time.Time)
|
|
// proxyDescUpdatedAt is the schema descriptor for updated_at field.
|
|
proxyDescUpdatedAt := proxyMixinFields0[1].Descriptor()
|
|
// proxy.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
proxy.DefaultUpdatedAt = proxyDescUpdatedAt.Default.(func() time.Time)
|
|
// proxy.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
proxy.UpdateDefaultUpdatedAt = proxyDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
// proxyDescName is the schema descriptor for name field.
|
|
proxyDescName := proxyFields[0].Descriptor()
|
|
// proxy.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
proxy.NameValidator = func() func(string) error {
|
|
validators := proxyDescName.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
|
|
}
|
|
}()
|
|
// proxyDescProtocol is the schema descriptor for protocol field.
|
|
proxyDescProtocol := proxyFields[1].Descriptor()
|
|
// proxy.ProtocolValidator is a validator for the "protocol" field. It is called by the builders before save.
|
|
proxy.ProtocolValidator = func() func(string) error {
|
|
validators := proxyDescProtocol.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(protocol string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(protocol); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// proxyDescHost is the schema descriptor for host field.
|
|
proxyDescHost := proxyFields[2].Descriptor()
|
|
// proxy.HostValidator is a validator for the "host" field. It is called by the builders before save.
|
|
proxy.HostValidator = func() func(string) error {
|
|
validators := proxyDescHost.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(host string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(host); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// proxyDescUsername is the schema descriptor for username field.
|
|
proxyDescUsername := proxyFields[4].Descriptor()
|
|
// proxy.UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
|
proxy.UsernameValidator = proxyDescUsername.Validators[0].(func(string) error)
|
|
// proxyDescPassword is the schema descriptor for password field.
|
|
proxyDescPassword := proxyFields[5].Descriptor()
|
|
// proxy.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
proxy.PasswordValidator = proxyDescPassword.Validators[0].(func(string) error)
|
|
// proxyDescStatus is the schema descriptor for status field.
|
|
proxyDescStatus := proxyFields[6].Descriptor()
|
|
// proxy.DefaultStatus holds the default value on creation for the status field.
|
|
proxy.DefaultStatus = proxyDescStatus.Default.(string)
|
|
// proxy.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
proxy.StatusValidator = proxyDescStatus.Validators[0].(func(string) error)
|
|
redeemcodeFields := schema.RedeemCode{}.Fields()
|
|
_ = redeemcodeFields
|
|
// redeemcodeDescCode is the schema descriptor for code field.
|
|
redeemcodeDescCode := redeemcodeFields[0].Descriptor()
|
|
// redeemcode.CodeValidator is a validator for the "code" field. It is called by the builders before save.
|
|
redeemcode.CodeValidator = func() func(string) error {
|
|
validators := redeemcodeDescCode.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(code string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(code); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// redeemcodeDescType is the schema descriptor for type field.
|
|
redeemcodeDescType := redeemcodeFields[1].Descriptor()
|
|
// redeemcode.DefaultType holds the default value on creation for the type field.
|
|
redeemcode.DefaultType = redeemcodeDescType.Default.(string)
|
|
// redeemcode.TypeValidator is a validator for the "type" field. It is called by the builders before save.
|
|
redeemcode.TypeValidator = redeemcodeDescType.Validators[0].(func(string) error)
|
|
// redeemcodeDescValue is the schema descriptor for value field.
|
|
redeemcodeDescValue := redeemcodeFields[2].Descriptor()
|
|
// redeemcode.DefaultValue holds the default value on creation for the value field.
|
|
redeemcode.DefaultValue = redeemcodeDescValue.Default.(float64)
|
|
// redeemcodeDescStatus is the schema descriptor for status field.
|
|
redeemcodeDescStatus := redeemcodeFields[3].Descriptor()
|
|
// redeemcode.DefaultStatus holds the default value on creation for the status field.
|
|
redeemcode.DefaultStatus = redeemcodeDescStatus.Default.(string)
|
|
// redeemcode.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
redeemcode.StatusValidator = redeemcodeDescStatus.Validators[0].(func(string) error)
|
|
// redeemcodeDescCreatedAt is the schema descriptor for created_at field.
|
|
redeemcodeDescCreatedAt := redeemcodeFields[7].Descriptor()
|
|
// redeemcode.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
redeemcode.DefaultCreatedAt = redeemcodeDescCreatedAt.Default.(func() time.Time)
|
|
// redeemcodeDescValidityDays is the schema descriptor for validity_days field.
|
|
redeemcodeDescValidityDays := redeemcodeFields[9].Descriptor()
|
|
// redeemcode.DefaultValidityDays holds the default value on creation for the validity_days field.
|
|
redeemcode.DefaultValidityDays = redeemcodeDescValidityDays.Default.(int)
|
|
settingFields := schema.Setting{}.Fields()
|
|
_ = settingFields
|
|
// settingDescKey is the schema descriptor for key field.
|
|
settingDescKey := settingFields[0].Descriptor()
|
|
// setting.KeyValidator is a validator for the "key" field. It is called by the builders before save.
|
|
setting.KeyValidator = func() func(string) error {
|
|
validators := settingDescKey.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(key string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(key); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// settingDescValue is the schema descriptor for value field.
|
|
settingDescValue := settingFields[1].Descriptor()
|
|
// setting.ValueValidator is a validator for the "value" field. It is called by the builders before save.
|
|
setting.ValueValidator = settingDescValue.Validators[0].(func(string) error)
|
|
// settingDescUpdatedAt is the schema descriptor for updated_at field.
|
|
settingDescUpdatedAt := settingFields[2].Descriptor()
|
|
// setting.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
setting.DefaultUpdatedAt = settingDescUpdatedAt.Default.(func() time.Time)
|
|
// setting.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
setting.UpdateDefaultUpdatedAt = settingDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
userMixin := schema.User{}.Mixin()
|
|
userMixinHooks1 := userMixin[1].Hooks()
|
|
user.Hooks[0] = userMixinHooks1[0]
|
|
userMixinInters1 := userMixin[1].Interceptors()
|
|
user.Interceptors[0] = userMixinInters1[0]
|
|
userMixinFields0 := userMixin[0].Fields()
|
|
_ = userMixinFields0
|
|
userFields := schema.User{}.Fields()
|
|
_ = userFields
|
|
// userDescCreatedAt is the schema descriptor for created_at field.
|
|
userDescCreatedAt := userMixinFields0[0].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[1].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)
|
|
// userDescEmail is the schema descriptor for email field.
|
|
userDescEmail := userFields[0].Descriptor()
|
|
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
|
|
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
|
|
}
|
|
}()
|
|
// userDescPasswordHash is the schema descriptor for password_hash field.
|
|
userDescPasswordHash := userFields[1].Descriptor()
|
|
// user.PasswordHashValidator is a validator for the "password_hash" field. It is called by the builders before save.
|
|
user.PasswordHashValidator = func() func(string) error {
|
|
validators := userDescPasswordHash.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(password_hash string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(password_hash); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// userDescRole is the schema descriptor for role field.
|
|
userDescRole := userFields[2].Descriptor()
|
|
// user.DefaultRole holds the default value on creation for the role field.
|
|
user.DefaultRole = userDescRole.Default.(string)
|
|
// user.RoleValidator is a validator for the "role" field. It is called by the builders before save.
|
|
user.RoleValidator = userDescRole.Validators[0].(func(string) error)
|
|
// userDescBalance is the schema descriptor for balance field.
|
|
userDescBalance := userFields[3].Descriptor()
|
|
// user.DefaultBalance holds the default value on creation for the balance field.
|
|
user.DefaultBalance = userDescBalance.Default.(float64)
|
|
// userDescConcurrency is the schema descriptor for concurrency field.
|
|
userDescConcurrency := userFields[4].Descriptor()
|
|
// user.DefaultConcurrency holds the default value on creation for the concurrency field.
|
|
user.DefaultConcurrency = userDescConcurrency.Default.(int)
|
|
// userDescStatus is the schema descriptor for status field.
|
|
userDescStatus := userFields[5].Descriptor()
|
|
// user.DefaultStatus holds the default value on creation for the status field.
|
|
user.DefaultStatus = userDescStatus.Default.(string)
|
|
// user.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
user.StatusValidator = userDescStatus.Validators[0].(func(string) error)
|
|
// userDescUsername is the schema descriptor for username field.
|
|
userDescUsername := userFields[6].Descriptor()
|
|
// user.DefaultUsername holds the default value on creation for the username field.
|
|
user.DefaultUsername = userDescUsername.Default.(string)
|
|
// 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)
|
|
// userDescWechat is the schema descriptor for wechat field.
|
|
userDescWechat := userFields[7].Descriptor()
|
|
// user.DefaultWechat holds the default value on creation for the wechat field.
|
|
user.DefaultWechat = userDescWechat.Default.(string)
|
|
// user.WechatValidator is a validator for the "wechat" field. It is called by the builders before save.
|
|
user.WechatValidator = userDescWechat.Validators[0].(func(string) error)
|
|
// userDescNotes is the schema descriptor for notes field.
|
|
userDescNotes := userFields[8].Descriptor()
|
|
// user.DefaultNotes holds the default value on creation for the notes field.
|
|
user.DefaultNotes = userDescNotes.Default.(string)
|
|
userallowedgroupFields := schema.UserAllowedGroup{}.Fields()
|
|
_ = userallowedgroupFields
|
|
// userallowedgroupDescCreatedAt is the schema descriptor for created_at field.
|
|
userallowedgroupDescCreatedAt := userallowedgroupFields[2].Descriptor()
|
|
// userallowedgroup.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
userallowedgroup.DefaultCreatedAt = userallowedgroupDescCreatedAt.Default.(func() time.Time)
|
|
usersubscriptionMixin := schema.UserSubscription{}.Mixin()
|
|
usersubscriptionMixinFields0 := usersubscriptionMixin[0].Fields()
|
|
_ = usersubscriptionMixinFields0
|
|
usersubscriptionFields := schema.UserSubscription{}.Fields()
|
|
_ = usersubscriptionFields
|
|
// usersubscriptionDescCreatedAt is the schema descriptor for created_at field.
|
|
usersubscriptionDescCreatedAt := usersubscriptionMixinFields0[0].Descriptor()
|
|
// usersubscription.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
usersubscription.DefaultCreatedAt = usersubscriptionDescCreatedAt.Default.(func() time.Time)
|
|
// usersubscriptionDescUpdatedAt is the schema descriptor for updated_at field.
|
|
usersubscriptionDescUpdatedAt := usersubscriptionMixinFields0[1].Descriptor()
|
|
// usersubscription.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
usersubscription.DefaultUpdatedAt = usersubscriptionDescUpdatedAt.Default.(func() time.Time)
|
|
// usersubscription.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
usersubscription.UpdateDefaultUpdatedAt = usersubscriptionDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
// usersubscriptionDescStatus is the schema descriptor for status field.
|
|
usersubscriptionDescStatus := usersubscriptionFields[4].Descriptor()
|
|
// usersubscription.DefaultStatus holds the default value on creation for the status field.
|
|
usersubscription.DefaultStatus = usersubscriptionDescStatus.Default.(string)
|
|
// usersubscription.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
usersubscription.StatusValidator = usersubscriptionDescStatus.Validators[0].(func(string) error)
|
|
// usersubscriptionDescDailyUsageUsd is the schema descriptor for daily_usage_usd field.
|
|
usersubscriptionDescDailyUsageUsd := usersubscriptionFields[8].Descriptor()
|
|
// usersubscription.DefaultDailyUsageUsd holds the default value on creation for the daily_usage_usd field.
|
|
usersubscription.DefaultDailyUsageUsd = usersubscriptionDescDailyUsageUsd.Default.(float64)
|
|
// usersubscriptionDescWeeklyUsageUsd is the schema descriptor for weekly_usage_usd field.
|
|
usersubscriptionDescWeeklyUsageUsd := usersubscriptionFields[9].Descriptor()
|
|
// usersubscription.DefaultWeeklyUsageUsd holds the default value on creation for the weekly_usage_usd field.
|
|
usersubscription.DefaultWeeklyUsageUsd = usersubscriptionDescWeeklyUsageUsd.Default.(float64)
|
|
// usersubscriptionDescMonthlyUsageUsd is the schema descriptor for monthly_usage_usd field.
|
|
usersubscriptionDescMonthlyUsageUsd := usersubscriptionFields[10].Descriptor()
|
|
// usersubscription.DefaultMonthlyUsageUsd holds the default value on creation for the monthly_usage_usd field.
|
|
usersubscription.DefaultMonthlyUsageUsd = usersubscriptionDescMonthlyUsageUsd.Default.(float64)
|
|
// usersubscriptionDescAssignedAt is the schema descriptor for assigned_at field.
|
|
usersubscriptionDescAssignedAt := usersubscriptionFields[12].Descriptor()
|
|
// usersubscription.DefaultAssignedAt holds the default value on creation for the assigned_at field.
|
|
usersubscription.DefaultAssignedAt = usersubscriptionDescAssignedAt.Default.(func() time.Time)
|
|
}
|
|
|
|
const (
|
|
Version = "v0.14.5" // Version of ent codegen.
|
|
Sum = "h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=" // Sum of ent codegen.
|
|
)
|