Documentation
¶
Index ¶
- type Config
- type Controller
- type HandlerFunc
- type Logger
- type Repository
- func (m *Repository) Delete(tx *Transaction, entry interface{}) (err error)
- func (m *Repository) Insert(tx *Transaction, entry interface{}) (err error)
- func (m *Repository) Remove(tx *Transaction, entry interface{}) (err error)
- func (m *Repository) Update(tx *Transaction, entry interface{}) (err error)
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller of storage
func New ¶
New storage controller consructor. Pass nil to `log` to use the default logger of gorm. default settings:
- SetMaxIdleConns: 0 = unlimited
- SetMaxOpenConns: 0 = unlimited
func (*Controller) Begin ¶
func (c *Controller) Begin() (tx *Transaction, err error)
Begin a transaction
func (*Controller) UseTransaction ¶
func (c *Controller) UseTransaction(fn HandlerFunc) (err error)
UseTransaction executes a HandlerFunc within a storage transaction
type HandlerFunc ¶
type HandlerFunc func(tx *Transaction) (err error)
HandlerFunc is to be handled by a storage transaction
type Repository ¶
type Repository struct{}
Repository embeddable struct for database repositories (embedd this in your repository struct)
func (*Repository) Delete ¶
func (m *Repository) Delete(tx *Transaction, entry interface{}) (err error)
Delete some existing data entry
func (*Repository) Insert ¶
func (m *Repository) Insert(tx *Transaction, entry interface{}) (err error)
Insert data entry to database
func (*Repository) Remove ¶
func (m *Repository) Remove(tx *Transaction, entry interface{}) (err error)
Remove (completely) some existing data entry
func (*Repository) Update ¶
func (m *Repository) Update(tx *Transaction, entry interface{}) (err error)
Update some existing data entry
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction for a storage action
Click to show internal directories.
Click to hide internal directories.