Documentation
¶
Index ¶
- type Context
- func (context Context) GetCreatedAt() time.Time
- func (context Context) GetDeletedAt() database.NullTime
- func (context Context) GetID() int64
- func (context Context) GetName() string
- func (context Context) GetUpdatedAt() time.Time
- func (context Context) GetValue() string
- func (context Context) GetWarrantId() int64
- func (context Context) IsValid() bool
- type ContextRepository
- type ContextService
- func (svc ContextService) CreateAll(ctx context.Context, warrantId int64, spec ContextSetSpec) (ContextSetSpec, error)
- func (svc ContextService) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
- func (svc ContextService) ListByWarrantId(ctx context.Context, warrantIds []int64) (map[int64]ContextSetSpec, error)
- type ContextSetSpec
- type Model
- type MySQLRepository
- func (repository MySQLRepository) CreateAll(ctx context.Context, models []Model) ([]Model, error)
- func (repository MySQLRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
- func (repository MySQLRepository) ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Model, error)
- type PostgresRepository
- func (repository PostgresRepository) CreateAll(ctx context.Context, models []Model) ([]Model, error)
- func (repository PostgresRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
- func (repository PostgresRepository) ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Model, error)
- type SQLiteRepository
- func (repository SQLiteRepository) CreateAll(ctx context.Context, models []Model) ([]Model, error)
- func (repository SQLiteRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
- func (repository SQLiteRepository) ListByWarrantId(ctx context.Context, warrantIds []int64) ([]Model, error)
- type Spec
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 (Context) GetCreatedAt ¶ added in v0.8.0
func (Context) GetDeletedAt ¶ added in v0.8.0
func (Context) GetUpdatedAt ¶ added in v0.8.0
func (Context) GetWarrantId ¶ added in v0.8.0
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 ¶
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 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
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) DeleteAllByWarrantId ¶ added in v0.11.0
func (repository SQLiteRepository) DeleteAllByWarrantId(ctx context.Context, warrantId int64) error
func (SQLiteRepository) ListByWarrantId ¶ added in v0.11.0
Click to show internal directories.
Click to hide internal directories.