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

     1  package schema
     2  
     3  import (
     4  	"entgo.io/ent"
     5  	"entgo.io/ent/dialect"
     6  	"entgo.io/ent/schema/field"
     7  	"github.com/NpoolPlatform/chain-middleware/pkg/db/mixin"
     8  	crudermixin "github.com/NpoolPlatform/libent-cruder/pkg/mixin"
     9  	"github.com/google/uuid"
    10  	"github.com/shopspring/decimal"
    11  )
    12  
    13  // AppCoin holds the schema definition for the AppCoin entity.
    14  type AppCoin struct {
    15  	ent.Schema
    16  }
    17  
    18  func (AppCoin) Mixin() []ent.Mixin {
    19  	return []ent.Mixin{
    20  		mixin.TimeMixin{},
    21  		crudermixin.AutoIDMixin{},
    22  	}
    23  }
    24  
    25  // Fields of the AppCoin.
    26  func (AppCoin) Fields() []ent.Field {
    27  	return []ent.Field{
    28  		field.
    29  			UUID("app_id", uuid.UUID{}).
    30  			Optional().
    31  			Default(uuid.New),
    32  		field.
    33  			UUID("coin_type_id", uuid.UUID{}).
    34  			Optional().
    35  			Default(uuid.New),
    36  		field.
    37  			String("name").
    38  			Optional().
    39  			Default(""),
    40  		field.
    41  			JSON("display_names", []string{}).
    42  			Optional().
    43  			Default([]string{}),
    44  		field.
    45  			String("logo").
    46  			Optional().
    47  			Default(""),
    48  		field.
    49  			Bool("for_pay").
    50  			Optional().
    51  			Default(false),
    52  		field.
    53  			Other("withdraw_auto_review_amount", decimal.Decimal{}).
    54  			SchemaType(map[string]string{
    55  				dialect.MySQL: "decimal(37,18)",
    56  			}).
    57  			Optional().
    58  			Default(decimal.Decimal{}),
    59  		field.
    60  			String("product_page").
    61  			Optional().
    62  			Default(""),
    63  		field.
    64  			Bool("disabled").
    65  			Optional().
    66  			Default(false),
    67  		field.
    68  			Other("daily_reward_amount", decimal.Decimal{}).
    69  			SchemaType(map[string]string{
    70  				dialect.MySQL: "decimal(37,18)",
    71  			}).
    72  			Optional().
    73  			Default(decimal.Decimal{}),
    74  		field.
    75  			Bool("display").
    76  			Optional().
    77  			Default(true),
    78  		field.
    79  			Uint32("display_index").
    80  			Optional().
    81  			Default(0),
    82  		field.
    83  			Other("max_amount_per_withdraw", decimal.Decimal{}).
    84  			SchemaType(map[string]string{
    85  				dialect.MySQL: "decimal(37,18)",
    86  			}).
    87  			Optional().
    88  			Default(decimal.Decimal{}),
    89  	}
    90  }
    91  
    92  // Edges of the AppCoin.
    93  func (AppCoin) Edges() []ent.Edge {
    94  	return nil
    95  }