context

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 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"`
	WarrantId int64             `mysql:"warrantId" postgres:"warrant_id"`
	Name      string            `mysql:"name" postgres:"name"`
	Value     string            `mysql:"value" postgres:"value"`
	CreatedAt time.Time         `mysql:"createdAt" postgres:"created_at"`
	UpdatedAt time.Time         `mysql:"updatedAt" postgres:"updated_at"`
	DeletedAt database.NullTime `mysql:"deletedAt" postgres:"deleted_at"`
}

Context model

func (Context) IsValid

func (context Context) IsValid() bool

type ContextRepository

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

func NewRepository

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

type ContextSetSpec

type ContextSetSpec map[string]string

func NewContextSetSpecFromSlice

func NewContextSetSpecFromSlice(contexts []Context) 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) []Context

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, contexts []Context) ([]Context, 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) ([]Context, 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, contexts []Context) ([]Context, 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) ([]Context, error)

Jump to

Keyboard shortcuts

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