29 lines
904 B
Go
29 lines
904 B
Go
package system
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"management/internal/erpserver/model/dto"
|
|
)
|
|
|
|
type ConfigRepository interface {
|
|
Create(ctx context.Context, obj *Config) error
|
|
Update(ctx context.Context, obj *Config) error
|
|
Get(ctx context.Context, id int32) (*Config, error)
|
|
GetByKey(ctx context.Context, key string) (*Config, error)
|
|
List(ctx context.Context, q dto.SearchDto) ([]*Config, int64, error)
|
|
}
|
|
|
|
type Config struct {
|
|
ID int32 `json:"id" gorm:"primaryKey;autoIncrement;not null"`
|
|
Key string `json:"key" gorm:"type:varchar(200);not null;uniqueIndex"`
|
|
Value []byte `json:"value" gorm:"type:bytea;not null;"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"type:timestamptz;not null;default:'now()'"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"type:timestamptz;not null;default:'0001-01-01 00:00:00+8';"`
|
|
}
|
|
|
|
func (Config) TableName() string {
|
|
return "sys_config"
|
|
}
|