github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/schema/fiatcurrencyhistory.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  // FiatCurrencyHistory holds the schema definition for the FiatCurrencyHistory entity.
    16  type FiatCurrencyHistory struct {
    17  	ent.Schema
    18  }
    19  
    20  func (FiatCurrencyHistory) Mixin() []ent.Mixin {
    21  	return []ent.Mixin{
    22  		mixin.TimeMixin{},
    23  		crudermixin.AutoIDMixin{},
    24  	}
    25  }
    26  
    27  // Fields of the FiatCurrencyHistory.
    28  func (FiatCurrencyHistory) Fields() []ent.Field {
    29  	return []ent.Field{
    30  		field.
    31  			UUID("fiat_id", uuid.UUID{}).
    32  			Optional().
    33  			Default(uuid.New),
    34  		field.
    35  			String("feed_type").
    36  			Optional().
    37  			Default(basetypes.CurrencyFeedType_DefaultFeedType.String()),
    38  		field.
    39  			Other("market_value_low", decimal.Decimal{}).
    40  			SchemaType(map[string]string{
    41  				dialect.MySQL: "decimal(37,18)",
    42  			}).
    43  			Optional().
    44  			Default(decimal.Decimal{}),
    45  		field.
    46  			Other("market_value_high", decimal.Decimal{}).
    47  			SchemaType(map[string]string{
    48  				dialect.MySQL: "decimal(37,18)",
    49  			}).
    50  			Optional().
    51  			Default(decimal.Decimal{}),
    52  	}
    53  }
    54  
    55  // Edges of the FiatCurrencyHistory.
    56  func (FiatCurrencyHistory) Edges() []ent.Edge {
    57  	return nil
    58  }