github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/schema/currencyfeed.go (about) 1 package schema 2 3 import ( 4 "entgo.io/ent" 5 "entgo.io/ent/schema/field" 6 "entgo.io/ent/schema/index" 7 "github.com/NpoolPlatform/chain-middleware/pkg/db/mixin" 8 crudermixin "github.com/NpoolPlatform/libent-cruder/pkg/mixin" 9 basetypes "github.com/NpoolPlatform/message/npool/basetypes/v1" 10 "github.com/google/uuid" 11 ) 12 13 // CurrencyFeed holds the schema definition for the CurrencyFeed entity. 14 type CurrencyFeed struct { 15 ent.Schema 16 } 17 18 func (CurrencyFeed) Mixin() []ent.Mixin { 19 return []ent.Mixin{ 20 mixin.TimeMixin{}, 21 crudermixin.AutoIDMixin{}, 22 } 23 } 24 25 // Fields of the CurrencyFeed. 26 func (CurrencyFeed) Fields() []ent.Field { 27 return []ent.Field{ 28 field. 29 UUID("coin_type_id", uuid.UUID{}). 30 Optional(). 31 Default(uuid.New), 32 field. 33 String("feed_type"). 34 Optional(). 35 Default(basetypes.CurrencyFeedType_DefaultFeedType.String()), 36 field. 37 String("feed_coin_name"). 38 Optional(). 39 Default(""), 40 field. 41 Bool("disabled"). 42 Optional(). 43 Default(false), 44 } 45 } 46 47 // Edges of the CurrencyFeed. 48 func (CurrencyFeed) Edges() []ent.Edge { 49 return nil 50 } 51 52 func (CurrencyFeed) Indexes() []ent.Index { 53 return []ent.Index{ 54 index.Fields("coin_type_id", "id"), 55 index.Fields("coin_type_id"), 56 } 57 }