github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/schema/coinusedfor.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  	types "github.com/NpoolPlatform/message/npool/basetypes/chain/v1"
     9  	"github.com/google/uuid"
    10  )
    11  
    12  // CoinUsedFor holds the schema definition for the CoinUsedFor entity.
    13  type CoinUsedFor struct {
    14  	ent.Schema
    15  }
    16  
    17  func (CoinUsedFor) Mixin() []ent.Mixin {
    18  	return []ent.Mixin{
    19  		mixin.TimeMixin{},
    20  		crudermixin.AutoIDMixin{},
    21  	}
    22  }
    23  
    24  // Fields of the CoinUsedFor.
    25  func (CoinUsedFor) 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  			String("used_for").
    33  			Optional().
    34  			Default(types.CoinUsedFor_DefaultCoinUsedFor.String()),
    35  		field.
    36  			Uint32("priority").
    37  			Optional().
    38  			Default(1),
    39  	}
    40  }
    41  
    42  // Edges of the CoinUsedFor.
    43  func (CoinUsedFor) Edges() []ent.Edge {
    44  	return nil
    45  }