Documentation ¶
Index ¶
- Variables
- func DatabaseDriverSQLite(driver string, config *ConfigService) (gorm.Dialector, error)
- type ConfigService
- type DatabaseConnection
- type DatabaseDriverInitializer
- type Repository
- func (r *Repository[T]) Create(value *T) error
- func (r *Repository[T]) Delete(conds ...interface{}) error
- func (r *Repository[T]) Find(conds ...interface{}) ([]*T, error)
- func (r *Repository[T]) FindOne(conds ...interface{}) (*T, error)
- func (r *Repository[T]) Init(self plouf.IInjectable) error
- func (r *Repository[T]) Save(value *T) error
- func (r *Repository[T]) ShouldLogInjection(self plouf.IInjectable) bool
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 ¶
func (*ConfigService) Get ¶
func (s *ConfigService) Get(key 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
Click to show internal directories.
Click to hide internal directories.