github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/schema/coinfiat.go (about)

     1  package schema
     2  
     3  import (
     4  	"entgo.io/ent"
     5  	"entgo.io/ent/schema/field"
     6  	"github.com/NpoolPlatform/chain-middleware/pkg/db/mixin"
     7  	crudermixin "github.com/NpoolPlatform/libent-cruder/pkg/mixin"
     8  	basetypes "github.com/NpoolPlatform/message/npool/basetypes/v1"
     9  	"github.com/google/uuid"
    10  )
    11  
    12  // CoinFiat holds the schema definition for the CoinFiat entity.
    13  type CoinFiat struct {
    14  	ent.Schema
    15  }
    16  
    17  func (CoinFiat) Mixin() []ent.Mixin {
    18  	return []ent.Mixin{
    19  		mixin.TimeMixin{},
    20  		crudermixin.AutoIDMixin{},
    21  	}
    22  }
    23  
    24  // Fields of the CoinFiat.
    25  func (CoinFiat) Fields() []ent.Field {
    26  	return []ent.Field{
    27  		field.
    28  			UUID("coin_type_id", uuid.UUID{}).
    29  			Optional().
    30  			Default(uuid.New),
    31  		field.
    32  			UUID("fiat_id", uuid.UUID{}).
    33  			Optional().
    34  			Default(uuid.New),
    35  		field.
    36  			String("feed_type").
    37  			Optional().
    38  			Default(basetypes.CurrencyFeedType_DefaultFeedType.String()),
    39  	}
    40  }
    41  
    42  // Edges of the CoinFiat.
    43  func (CoinFiat) Edges() []ent.Edge {
    44  	return nil
    45  }