github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/schema/coindescription.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  // CoinDescription holds the schema definition for the CoinDescription entity.
    13  type CoinDescription struct {
    14  	ent.Schema
    15  }
    16  
    17  func (CoinDescription) Mixin() []ent.Mixin {
    18  	return []ent.Mixin{
    19  		mixin.TimeMixin{},
    20  		crudermixin.AutoIDMixin{},
    21  	}
    22  }
    23  
    24  // Fields of the CoinDescription.
    25  func (CoinDescription) Fields() []ent.Field {
    26  	return []ent.Field{
    27  		field.
    28  			UUID("app_id", uuid.UUID{}).
    29  			Optional().
    30  			Default(uuid.New),
    31  		field.
    32  			UUID("coin_type_id", uuid.UUID{}).
    33  			Optional().
    34  			Default(uuid.New),
    35  		field.
    36  			String("used_for").
    37  			Optional().
    38  			Default(basetypes.UsedFor_DefaultUsedFor.String()),
    39  		field.
    40  			String("title").
    41  			Optional().
    42  			Default(""),
    43  		field.
    44  			String("message").
    45  			Optional().
    46  			Default(""),
    47  	}
    48  }
    49  
    50  // Edges of the CoinDescription.
    51  func (CoinDescription) Edges() []ent.Edge {
    52  	return nil
    53  }