plouf_modules

package
v0.0.0-...-cd205bd Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DatabaseDrivers = map[string]DatabaseDriverInitializer{
	"sqlite": DatabaseDriverSQLite,
}

Functions

func DatabaseDriverSQLite

func DatabaseDriverSQLite(driver string, config *ConfigService) (gorm.Dialector, error)

Types

type ConfigService

type ConfigService struct {
	plouf.Service
	// contains filtered or unexported fields
}

func (*ConfigService) Get

func (s *ConfigService) Get(key string) string

func (*ConfigService) GetOr

func (s *ConfigService) GetOr(key string, fallback string) string

func (*ConfigService) Init

func (s *ConfigService) Init(self plouf.IInjectable) error

func (*ConfigService) Set

func (s *ConfigService) Set(key string, value string)

type DatabaseConnection

type DatabaseConnection struct {
	plouf.Service

	ConfigService *ConfigService

	Database *gorm.DB
}

func (*DatabaseConnection) Init

func (d *DatabaseConnection) Init(self plouf.IInjectable) error

type DatabaseDriverInitializer

type DatabaseDriverInitializer func(driver string, config *ConfigService) (gorm.Dialector, error)

type Repository

type Repository[T interface{}] struct {
	plouf.Injectable

	Connection *DatabaseConnection
}

func (*Repository[T]) Create

func (r *Repository[T]) Create(value *T) error

func (*Repository[T]) Delete

func (r *Repository[T]) Delete(conds ...interface{}) error

func (*Repository[T]) Find

func (r *Repository[T]) Find(conds ...interface{}) ([]*T, error)

func (*Repository[T]) FindOne

func (r *Repository[T]) FindOne(conds ...interface{}) (*T, error)

func (*Repository[T]) Init

func (r *Repository[T]) Init(self plouf.IInjectable) error

func (*Repository[T]) Save

func (r *Repository[T]) Save(value *T) error

func (*Repository[T]) ShouldLogInjection

func (r *Repository[T]) ShouldLogInjection(self plouf.IInjectable) bool

Jump to

Keyboard shortcuts

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