Documentation
¶
Index ¶
- Variables
- type DefaultService
- func (d *DefaultService) DB() *sql.DB
- func (d *DefaultService) Exec(query *string, params ...interface{}) (sql.Result, error)
- func (d *DefaultService) Migrate(queries ...string) error
- func (d *DefaultService) QueryRow(query *string, params ...interface{}) *sql.Row
- func (d *DefaultService) RunTransaction(fn func(tx *sql.Tx) error) error
- func (d *DefaultService) ScanRow(row *sql.Row, destinations ...interface{}) error
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNilService = errors.New("service cannot be nil")
)
Functions ¶
This section is empty.
Types ¶
type DefaultService ¶
type DefaultService struct {
// contains filtered or unexported fields
}
DefaultService is the default service struct
func NewDefaultService ¶
func NewDefaultService(db *sql.DB) ( instance *DefaultService, err error, )
NewDefaultService creates a new default service
func (*DefaultService) Exec ¶
func (d *DefaultService) Exec(query *string, params ...interface{}) ( sql.Result, error, )
Exec executes a query with parameters and returns the result
func (*DefaultService) Migrate ¶
func (d *DefaultService) Migrate(queries ...string) error
Migrate migrates the database
func (*DefaultService) QueryRow ¶
func (d *DefaultService) QueryRow( query *string, params ...interface{}, ) *sql.Row
QueryRow runs a query row with parameters and returns the result row
func (*DefaultService) RunTransaction ¶
func (d *DefaultService) RunTransaction(fn func(tx *sql.Tx) error) error
RunTransaction runs a transaction
type Service ¶
type Service interface { DB() *sql.DB Migrate(queries ...string) error RunTransaction(fn func(tx *sql.Tx) error) error Exec(query *string, params ...interface{}) (sql.Result, error) QueryRow(query *string, params ...interface{}) *sql.Row ScanRow(row *sql.Row, destinations ...interface{}) error }
Service is the interface for the service
Click to show internal directories.
Click to hide internal directories.