github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/schema/coinfiatcurrency.go (about) 1 //nolint:dupl 2 package schema 3 4 import ( 5 "entgo.io/ent" 6 "entgo.io/ent/dialect" 7 "entgo.io/ent/schema/field" 8 "github.com/NpoolPlatform/chain-middleware/pkg/db/mixin" 9 crudermixin "github.com/NpoolPlatform/libent-cruder/pkg/mixin" 10 basetypes "github.com/NpoolPlatform/message/npool/basetypes/v1" 11 "github.com/google/uuid" 12 "github.com/shopspring/decimal" 13 ) 14 15 // CoinFiatCurrency holds the schema definition for the CoinFiatCurrency entity. 16 type CoinFiatCurrency struct { 17 ent.Schema 18 } 19 20 func (CoinFiatCurrency) Mixin() []ent.Mixin { 21 return []ent.Mixin{ 22 mixin.TimeMixin{}, 23 crudermixin.AutoIDMixin{}, 24 } 25 } 26 27 // Fields of the CoinFiatCurrency. 28 func (CoinFiatCurrency) Fields() []ent.Field { 29 return []ent.Field{ 30 field. 31 UUID("coin_type_id", uuid.UUID{}). 32 Optional(). 33 Default(uuid.New), 34 field. 35 UUID("fiat_id", uuid.UUID{}). 36 Optional(). 37 Default(uuid.New), 38 field. 39 String("feed_type"). 40 Optional(). 41 Default(basetypes.CurrencyFeedType_DefaultFeedType.String()), 42 field. 43 Other("market_value_low", decimal.Decimal{}). 44 SchemaType(map[string]string{ 45 dialect.MySQL: "decimal(37,18)", 46 }). 47 Optional(). 48 Default(decimal.Decimal{}), 49 field. 50 Other("market_value_high", decimal.Decimal{}). 51 SchemaType(map[string]string{ 52 dialect.MySQL: "decimal(37,18)", 53 }). 54 Optional(). 55 Default(decimal.Decimal{}), 56 } 57 } 58 59 // Edges of the CoinFiatCurrency. 60 func (CoinFiatCurrency) Edges() []ent.Edge { 61 return nil 62 }