github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/models/config.go (about)

     1  package models
     2  
     3  import (
     4  	"github.com/machinefi/w3bstream/pkg/depends/base/types"
     5  	"github.com/machinefi/w3bstream/pkg/depends/kit/sqlx/datatypes"
     6  	"github.com/machinefi/w3bstream/pkg/enums"
     7  )
     8  
     9  // Config database model config for configuration management
    10  // @def primary                          ID
    11  // @def unique_index UI_config_id        ConfigID
    12  // @def unique_index UI_rel_type         RelID Type
    13  //
    14  //go:generate toolkit gen model Config --database DB
    15  type Config struct {
    16  	datatypes.PrimaryID
    17  	RelConfig
    18  	ConfigBase
    19  	datatypes.OperationTimes
    20  }
    21  
    22  type RelConfig struct {
    23  	ConfigID types.SFID `db:"f_config_id" json:"configID"`
    24  }
    25  
    26  type ConfigBase struct {
    27  	RelID types.SFID       `db:"f_rel_id"           json:"relID"`
    28  	Type  enums.ConfigType `db:"f_type"             json:"type"`
    29  	Value []byte           `db:"f_value,default=''" json:"-"`
    30  }