github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/schema/coinbase.go (about) 1 package schema 2 3 import ( 4 "entgo.io/ent" 5 "entgo.io/ent/dialect" 6 "entgo.io/ent/schema/field" 7 "github.com/NpoolPlatform/chain-middleware/pkg/db/mixin" 8 crudermixin "github.com/NpoolPlatform/libent-cruder/pkg/mixin" 9 "github.com/shopspring/decimal" 10 ) 11 12 // CoinBase holds the schema definition for the CoinBase entity. 13 type CoinBase struct { 14 ent.Schema 15 } 16 17 func (CoinBase) Mixin() []ent.Mixin { 18 return []ent.Mixin{ 19 mixin.TimeMixin{}, 20 crudermixin.AutoIDMixin{}, 21 } 22 } 23 24 // Fields of the CoinBase. 25 func (CoinBase) Fields() []ent.Field { 26 return []ent.Field{ 27 field. 28 String("name"). 29 Optional(). 30 Default(""), 31 field. 32 String("logo"). 33 Optional(). 34 Default(""), 35 field. 36 Bool("presale"). 37 Optional(). 38 Default(false), 39 field. 40 String("unit"). 41 Optional(). 42 Default(""), 43 field. 44 String("env"). 45 Optional(). 46 Default(""), 47 field. 48 Other("reserved_amount", decimal.Decimal{}). 49 SchemaType(map[string]string{ 50 dialect.MySQL: "decimal(37,18)", 51 }). 52 Optional(). 53 Default(decimal.Decimal{}), 54 field. 55 Bool("for_pay"). 56 Optional(). 57 Default(false), 58 field. 59 Bool("disabled"). 60 Optional(). 61 Default(false), 62 } 63 } 64 65 // Edges of the CoinBase. 66 func (CoinBase) Edges() []ent.Edge { 67 return nil 68 }