context

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	ID        int64             `mysql:"id" postgres:"id" sqlite:"id"`
	WarrantId int64             `mysql:"warrantId" postgres:"warrant_id" sqlite:"warrantId"`
	Name      string            `mysql:"name" postgres:"name" sqlite:"name"`
	Value     string            `mysql:"value" postgres:"value" sqlite:"value"`
	CreatedAt time.Time         `mysql:"createdAt" postgres:"created_at" sqlite:"createdAt"`
	UpdatedAt time.Time         `mysql:"updatedAt" postgres:"updated_at" sqlite:"updatedAt"`
	DeletedAt database.NullTime `mysql:"deletedAt" postgres:"deleted_at" sqlite:"deletedAt"`
}

func NewContextFromModel added in v0.8.0

func NewContextFromModel(model Model) *Context

func (Context) GetCreatedAt added in v0.8.0

func (context Context) GetCreatedAt() time.Time

func (Context) GetDeletedAt added in v0.8.0

func (context Context) GetDeletedAt() database.NullTime

func (Context) GetID added in v0.8.0

func (context Context) GetID() int64

func (Context) GetName added in v0.8.0

func (context Context) GetName() string

func (Context) GetUpdatedAt added in v0.8.0

func (context Context) GetUpdatedAt() time.Time

func (Context) GetValue added in v0.8.0

func (context Context) GetValue() string

func (Context) GetWarrantId added in v0.8.0

func (context Context) GetWarrantId() int64

func (Context) IsValid

func (context Context) IsValid() bool

type ContextRepository

type ContextRepository interface {
	CreateAll(ctx context.Context, contexts []Model) ([]Model, error)
	ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Model, error)
	DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
}

func NewRepository

func NewRepository(db database.Database) (ContextRepository, error)

type ContextService added in v0.8.0

type ContextService struct {
	service.BaseService
	// contains filtered or unexported fields
}

func NewService added in v0.8.0

func NewService(env service.Env, repo ContextRepository) ContextService

func (ContextService) CreateAll added in v0.8.0

func (svc ContextService) CreateAll(ctx context.Context, warrantId int64, spec ContextSetSpec) (ContextSetSpec, error)

func (ContextService) DeleteAllByWarrantId added in v0.8.0

func (svc ContextService) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error

func (ContextService) ListByWarrantId added in v0.8.0

func (svc ContextService) ListByWarrantId(ctx context.Context, warrantIds []int64) (map[int64]ContextSetSpec, error)

type ContextSetSpec

type ContextSetSpec map[string]string

func NewContextSetSpecFromSlice

func NewContextSetSpecFromSlice(models []Model) ContextSetSpec

func StringToContextSetSpec

func StringToContextSetSpec(str string) (ContextSetSpec, error)

func (ContextSetSpec) Equals

func (spec ContextSetSpec) Equals(compareTo ContextSetSpec) bool

func (ContextSetSpec) String

func (spec ContextSetSpec) String() string

func (ContextSetSpec) ToHash

func (spec ContextSetSpec) ToHash() string

func (ContextSetSpec) ToSlice

func (spec ContextSetSpec) ToSlice(warrantId int64) []Model

type Model added in v0.8.0

type Model interface {
	GetID() int64
	GetWarrantId() int64
	GetName() string
	GetValue() string
	GetCreatedAt() time.Time
	GetUpdatedAt() time.Time
	GetDeletedAt() database.NullTime
	IsValid() bool
}

type MySQLRepository

type MySQLRepository struct {
	database.SQLRepository
}

func NewMySQLRepository

func NewMySQLRepository(db *database.MySQL) MySQLRepository

func (MySQLRepository) CreateAll

func (repository MySQLRepository) CreateAll(ctx context.Context, models []Model) ([]Model, error)

func (MySQLRepository) DeleteAllByWarrantId

func (repository MySQLRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error

func (MySQLRepository) ListByWarrantId

func (repository MySQLRepository) ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Model, error)

type PostgresRepository added in v0.4.0

type PostgresRepository struct {
	database.SQLRepository
}

func NewPostgresRepository added in v0.4.0

func NewPostgresRepository(db *database.Postgres) PostgresRepository

func (PostgresRepository) CreateAll added in v0.4.0

func (repository PostgresRepository) CreateAll(ctx context.Context, models []Model) ([]Model, error)

func (PostgresRepository) DeleteAllByWarrantId added in v0.4.0

func (repository PostgresRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error

func (PostgresRepository) ListByWarrantId added in v0.4.0

func (repository PostgresRepository) ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Model, error)

type SQLiteRepository added in v0.11.0

type SQLiteRepository struct {
	database.SQLRepository
}

func NewSQLiteRepository added in v0.11.0

func NewSQLiteRepository(db *database.SQLite) SQLiteRepository

func (SQLiteRepository) CreateAll added in v0.11.0

func (repository SQLiteRepository) CreateAll(ctx context.Context, models []Model) ([]Model, error)

func (SQLiteRepository) DeleteAllByWarrantId added in v0.11.0

func (repository SQLiteRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error

func (SQLiteRepository) ListByWarrantId added in v0.11.0

func (repository SQLiteRepository) ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Model, error)

type Spec added in v0.8.0

type Spec interface {
	ToHash() string
	ToSlice(warrantId int64) []Model
	String() string
	Equals(compareTo ContextSetSpec) bool
}

Jump to

Keyboard shortcuts

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