persistence

package
v0.0.0-...-5b0754e Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMysqlDBConnection

func GetMysqlDBConnection() (*gorm.DB, error)

func IsDuplicateEntry

func IsDuplicateEntry(err error) bool

Types

type Persistable

type Persistable interface {
	Persistable()
}

type Repository

type Repository struct {
	*gorm.DB
}

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

Jump to

Keyboard shortcuts

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