Documentation
¶
Index ¶
- type Context
- type ContextRepository
- type ContextSetSpec
- type MySQLRepository
- func (repository MySQLRepository) CreateAll(ctx context.Context, contexts []Context) ([]Context, error)
- func (repository MySQLRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
- func (repository MySQLRepository) ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Context, error)
- type PostgresRepository
- func (repository PostgresRepository) CreateAll(ctx context.Context, contexts []Context) ([]Context, error)
- func (repository PostgresRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
- func (repository PostgresRepository) ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Context, error)
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
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 ¶
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) DeleteAllByWarrantId ¶
func (repository MySQLRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
func (MySQLRepository) ListByWarrantId ¶
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) DeleteAllByWarrantId ¶ added in v0.4.0
func (repository PostgresRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
func (PostgresRepository) ListByWarrantId ¶ added in v0.4.0
Click to show internal directories.
Click to hide internal directories.