Documentation
¶
Index ¶
- func GetMysqlDBConnection() (*gorm.DB, error)
- func IsDuplicateEntry(err error) bool
- type Persistable
- type Repository
- func (rep *Repository) DeleteDueToError(model Persistable, originalError error) error
- func (rep *Repository) Get(obj Persistable, id uint) error
- func (rep *Repository) GetEnv(id uint) (*model.Environment, error)
- func (rep *Repository) GetEnvs() (*[]model.Environment, error)
- func (rep *Repository) GetEnvsByOwner(ownerId uint) (*[]model.Environment, error)
- func (rep *Repository) SaveModel(model Persistable) error
- func (rep *Repository) SoftDeleteEnv(env *model.Environment) error
- func (rep *Repository) WithTransaction(f func(tRep *Repository) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Persistable ¶
type Persistable interface {
Persistable()
}
type Repository ¶
func NewRepository ¶
func NewRepository(db *gorm.DB) (*Repository, error)
func (*Repository) DeleteDueToError ¶
func (rep *Repository) DeleteDueToError(model Persistable, originalError error) error
func (*Repository) Get ¶
func (rep *Repository) Get(obj Persistable, id uint) error
func (*Repository) GetEnv ¶
func (rep *Repository) GetEnv(id uint) (*model.Environment, error)
func (*Repository) GetEnvs ¶
func (rep *Repository) GetEnvs() (*[]model.Environment, error)
func (*Repository) GetEnvsByOwner ¶
func (rep *Repository) GetEnvsByOwner(ownerId uint) (*[]model.Environment, error)
func (*Repository) SaveModel ¶
func (rep *Repository) SaveModel(model Persistable) error
SaveModel Upsert-type function for model structs
func (*Repository) SoftDeleteEnv ¶
func (rep *Repository) SoftDeleteEnv(env *model.Environment) error
SoftDeleteEnv soft-delete when model has gorm.DeleteAt field
func (*Repository) WithTransaction ¶
func (rep *Repository) WithTransaction(f func(tRep *Repository) error) error
Click to show internal directories.
Click to hide internal directories.