78 lines
4.1 KiB
Go
78 lines
4.1 KiB
Go
// Copyright 2019-present Facebook Inc. All rights reserved.
|
|
// This source code is licensed under the Apache 2.0 license found
|
|
// in the LICENSE file in the root directory of this source tree.
|
|
|
|
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"entgo.io/ent/examples/migration/ent/card"
|
|
"entgo.io/ent/examples/migration/ent/payment"
|
|
"entgo.io/ent/examples/migration/ent/pet"
|
|
"entgo.io/ent/examples/migration/ent/schema"
|
|
"entgo.io/ent/examples/migration/ent/session"
|
|
"entgo.io/ent/examples/migration/ent/sessiondevice"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// 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() {
|
|
cardFields := schema.Card{}.Fields()
|
|
_ = cardFields
|
|
// cardDescType is the schema descriptor for type field.
|
|
cardDescType := cardFields[0].Descriptor()
|
|
// card.DefaultType holds the default value on creation for the type field.
|
|
card.DefaultType = cardDescType.Default.(string)
|
|
// cardDescOwnerID is the schema descriptor for owner_id field.
|
|
cardDescOwnerID := cardFields[4].Descriptor()
|
|
// card.DefaultOwnerID holds the default value on creation for the owner_id field.
|
|
card.DefaultOwnerID = cardDescOwnerID.Default.(int)
|
|
paymentFields := schema.Payment{}.Fields()
|
|
_ = paymentFields
|
|
// paymentDescAmount is the schema descriptor for amount field.
|
|
paymentDescAmount := paymentFields[1].Descriptor()
|
|
// payment.AmountValidator is a validator for the "amount" field. It is called by the builders before save.
|
|
payment.AmountValidator = paymentDescAmount.Validators[0].(func(float64) error)
|
|
petFields := schema.Pet{}.Fields()
|
|
_ = petFields
|
|
// petDescOwnerID is the schema descriptor for owner_id field.
|
|
petDescOwnerID := petFields[5].Descriptor()
|
|
// pet.DefaultOwnerID holds the default value on creation for the owner_id field.
|
|
pet.DefaultOwnerID = petDescOwnerID.Default.(int)
|
|
// petDescID is the schema descriptor for id field.
|
|
petDescID := petFields[0].Descriptor()
|
|
// pet.DefaultID holds the default value on creation for the id field.
|
|
pet.DefaultID = petDescID.Default.(func() uuid.UUID)
|
|
sessionFields := schema.Session{}.Fields()
|
|
_ = sessionFields
|
|
// sessionDescActive is the schema descriptor for active field.
|
|
sessionDescActive := sessionFields[1].Descriptor()
|
|
// session.DefaultActive holds the default value on creation for the active field.
|
|
session.DefaultActive = sessionDescActive.Default.(bool)
|
|
// sessionDescID is the schema descriptor for id field.
|
|
sessionDescID := sessionFields[0].Descriptor()
|
|
// session.DefaultID holds the default value on creation for the id field.
|
|
session.DefaultID = sessionDescID.Default.(func() uuid.UUID)
|
|
sessiondeviceFields := schema.SessionDevice{}.Fields()
|
|
_ = sessiondeviceFields
|
|
// sessiondeviceDescIPAddress is the schema descriptor for ip_address field.
|
|
sessiondeviceDescIPAddress := sessiondeviceFields[1].Descriptor()
|
|
// sessiondevice.IPAddressValidator is a validator for the "ip_address" field. It is called by the builders before save.
|
|
sessiondevice.IPAddressValidator = sessiondeviceDescIPAddress.Validators[0].(func(string) error)
|
|
// sessiondeviceDescUserAgent is the schema descriptor for user_agent field.
|
|
sessiondeviceDescUserAgent := sessiondeviceFields[2].Descriptor()
|
|
// sessiondevice.UserAgentValidator is a validator for the "user_agent" field. It is called by the builders before save.
|
|
sessiondevice.UserAgentValidator = sessiondeviceDescUserAgent.Validators[0].(func(string) error)
|
|
// sessiondeviceDescLocation is the schema descriptor for location field.
|
|
sessiondeviceDescLocation := sessiondeviceFields[3].Descriptor()
|
|
// sessiondevice.LocationValidator is a validator for the "location" field. It is called by the builders before save.
|
|
sessiondevice.LocationValidator = sessiondeviceDescLocation.Validators[0].(func(string) error)
|
|
// sessiondeviceDescID is the schema descriptor for id field.
|
|
sessiondeviceDescID := sessiondeviceFields[0].Descriptor()
|
|
// sessiondevice.DefaultID holds the default value on creation for the id field.
|
|
sessiondevice.DefaultID = sessiondeviceDescID.Default.(func() uuid.UUID)
|
|
}
|