text_lang

package
v0.0.0-...-4f702ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityName = "textLang"
	TableName  = "text_lang"
)
View Source
const (
	CodeEng = "eng"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	NewEntity() *TextLang
	DataInit(ctx context.Context, langsConfig config.Languages) error
	Get(ctx context.Context, id uint) (*TextLang, error)
	Query(ctx context.Context, query *selection_condition.SelectionCondition) ([]TextLang, error)
	Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error)
	Create(ctx context.Context, entity *TextLang) error
	Upsert(ctx context.Context, entity *TextLang) error
	Update(ctx context.Context, entity *TextLang) error
	Save(ctx context.Context, entity *TextLang) error
	Delete(ctx context.Context, id uint) error
	GetCodes(ctx context.Context) ([]string, error)
	GetCodesEmptyInterfaceSlice(ctx context.Context) ([]interface{}, error)
	GetMapCodeID(ctx context.Context) (map[string]uint, error)
	GetMapIDCode(ctx context.Context) (map[uint]string, error)
	GetMapIDCfgname(ctx context.Context) (map[uint]string, error)
	GetIDByCode(ctx context.Context, code string) (uint, error)
	GetCfgnameByID(ctx context.Context, id uint) (string, error)
}

IService encapsulates usecase logic.

func NewService

func NewService(logger log.Logger, repo Repository) IService

NewService creates a new service.

type LangFinder

type LangFinder interface {
	GetCodes(ctx context.Context) ([]string, error)
	GetCodesEmptyInterfaceSlice(ctx context.Context) ([]interface{}, error)
	GetMapCodeID(ctx context.Context) (map[string]uint, error)
	GetMapIDCode(ctx context.Context) (map[uint]string, error)
	GetMapIDCfgname(ctx context.Context) (map[uint]string, error)
	GetIDByCode(ctx context.Context, code string) (uint, error)
	GetCfgnameByID(ctx context.Context, id uint) (string, error)
}

type Repository

type Repository interface {
	SetDefaultConditions(conditions *selection_condition.SelectionCondition)
	// Get returns the album with the specified album ID.
	Get(ctx context.Context, id uint) (*TextLang, error)
	First(ctx context.Context, entity *TextLang) (*TextLang, error)
	// Query returns the list of albums with the given offset and limit.
	Query(ctx context.Context, cond *selection_condition.SelectionCondition) ([]TextLang, error)
	Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error)
	Create(ctx context.Context, entity *TextLang) error
	Upsert(ctx context.Context, entity *TextLang) error
	Update(ctx context.Context, entity *TextLang) error
	Save(ctx context.Context, entity *TextLang) error
	Delete(ctx context.Context, id uint) error
}

Repository encapsulates the logic to access albums from the data source.

type TextLang

type TextLang struct {
	ID        uint           `gorm:"type:serial;primaryKey" json:"id"`
	Code      string         `gorm:"type:varchar(100) not null;unique;index" json:"code"`
	Name      string         `gorm:"type:varchar(100) not null" json:"name"`
	Cfgname   string         `gorm:"type:varchar(100) not null" json:"cfgname"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt,omitempty"`
}

TextLang ...

func New

func New() *TextLang

New func is a constructor for the EntityType

func (*TextLang) TableName

func (e *TextLang) TableName() string

func (TextLang) Validate

func (e TextLang) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL