github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/schema/fiatcurrencyfeed.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  // FiatCurrencyFeed holds the schema definition for the FiatCurrencyFeed entity.
    14  type FiatCurrencyFeed struct {
    15  	ent.Schema
    16  }
    17  
    18  func (FiatCurrencyFeed) Mixin() []ent.Mixin {
    19  	return []ent.Mixin{
    20  		mixin.TimeMixin{},
    21  		crudermixin.AutoIDMixin{},
    22  	}
    23  }
    24  
    25  // Fields of the FiatCurrencyFeed.
    26  func (FiatCurrencyFeed) Fields() []ent.Field {
    27  	return []ent.Field{
    28  		field.
    29  			UUID("fiat_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_fiat_name").
    38  			Optional().
    39  			Default(""),
    40  		field.
    41  			Bool("disabled").
    42  			Optional().
    43  			Default(false),
    44  	}
    45  }
    46  
    47  // Edges of the FiatCurrencyFeed.
    48  func (FiatCurrencyFeed) Edges() []ent.Edge {
    49  	return nil
    50  }
    51  
    52  func (FiatCurrencyFeed) Indexes() []ent.Index {
    53  	return []ent.Index{
    54  		index.Fields("fiat_id", "id"),
    55  		index.Fields("fiat_id"),
    56  	}
    57  }