text_source

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityName = "textSource"
	TableName  = "text_source"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	NewEntity() *TextSource
	Get(ctx context.Context, id uint) (*TextSource, error)
	TGet(ctx context.Context, id uint, langID uint) (*TextSource, error)
	Query(ctx context.Context, query *selection_condition.SelectionCondition) ([]TextSource, error)
	Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error)
	Create(ctx context.Context, entity *TextSource) error
	Update(ctx context.Context, entity *TextSource) error
	Save(ctx context.Context, entity *TextSource) error
	Delete(ctx context.Context, id uint) error
}

IService encapsulates usecase logic.

func NewService

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

NewService creates a new service.

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) (*TextSource, error)
	TGet(ctx context.Context, id uint, langID uint) (*TextSource, error)
	First(ctx context.Context, entity *TextSource) (*TextSource, error)
	// Query returns the list of albums with the given offset and limit.
	Query(ctx context.Context, cond *selection_condition.SelectionCondition) ([]TextSource, error)
	Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error)
	Create(ctx context.Context, entity *TextSource) error
	Update(ctx context.Context, entity *TextSource) error
	Save(ctx context.Context, entity *TextSource) error
	Delete(ctx context.Context, id uint) error
	DeleteTx(ctx context.Context, tx *gorm.DB, id uint) error
	GetValuesTx(ctx context.Context, tx *gorm.DB, langID uint, sourceIDs ...*uint) ([]*string, error)
	CreateValueTx(ctx context.Context, tx *gorm.DB, value *string, langID uint) (sourceID *uint, err error)
	UpdateValueTx(ctx context.Context, tx *gorm.DB, sourceID *uint, value *string, langID uint) (resSourceID *uint, err error)
}

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

type TextSource

type TextSource struct {
	ID         uint                   `gorm:"type:bigserial;primaryKey" json:"id"`
	TextValue  *text_value.TextValue  `json:"textValue"`
	TextValues []text_value.TextValue `json:"textValues"`

	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt,omitempty"`
}

TextSource ...

func New

func New() *TextSource

New func is a constructor for the TextSource

func (*TextSource) TableName

func (e *TextSource) TableName() string

Jump to

Keyboard shortcuts

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