offer

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

Documentation

Index

Constants

View Source
const (
	EntityType                = "Offer"
	PropertySysnameCreatedAt  = "Offer.CreatedAt"
	PropertySysnameStartedAt  = "Offer.StartedAt"
	PropertySysnameFinishedAt = "Offer.FinishedAt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	New(ctx context.Context) (*Offer, error)
	Get(ctx context.Context, id uint, langID uint) (*Offer, error)
	Query(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) ([]Offer, error)
	First(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (*Offer, error)
	Count(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (uint, error)
	Create(ctx context.Context, obj *Offer, langID uint) error
	Update(ctx context.Context, obj *Offer, langID uint) error
	Delete(ctx context.Context, id uint) error
}

IService encapsulates usecase logic for user.

func NewService

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

NewService creates a new service.

type Offer

type Offer struct {
	*entity.Entity
	ID         uint
	CreatedAt  time.Time
	StartedAt  time.Time
	FinishedAt time.Time
}

Offer is the user entity

func (Offer) EntityType

func (e Offer) EntityType() string

func (*Offer) GetMapNameSysname

func (e *Offer) GetMapNameSysname() map[string]string

func (*Offer) GetValidPropertySysnames

func (e *Offer) GetValidPropertySysnames() []string

func (*Offer) SetCreatedAt

func (e *Offer) SetCreatedAt(ctx context.Context, value time.Time) error

func (*Offer) SetFinishedAt

func (e *Offer) SetFinishedAt(ctx context.Context, value time.Time) error

func (*Offer) SetStartedAt

func (e *Offer) SetStartedAt(ctx context.Context, value time.Time) error

func (Offer) Validate

func (e Offer) Validate() error

type Repository

type Repository interface {
	New(ctx context.Context) (*Offer, error)
	// Get returns the entity with the specified ID.
	Get(ctx context.Context, id uint, langID uint) (*Offer, error)
	// Query returns the list of albums with the given offset and limit.
	Query(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) ([]Offer, error)
	First(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (*Offer, error)
	// Count returns the number of items.
	Count(ctx context.Context, condition *selection_condition.SelectionCondition, langID uint) (uint, error)
	SetDefaultConditions(conditions *selection_condition.SelectionCondition)
	// Create saves a new album in the storage.
	Create(ctx context.Context, obj *Offer, langID uint) error
	// Update updates the album with given ID in the storage.
	Update(ctx context.Context, obj *Offer, langID uint) error
	// Delete removes the album with given ID from the storage.
	Delete(ctx context.Context, id uint) error
}

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

Jump to

Keyboard shortcuts

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