Documentation
¶
Index ¶
- Constants
- type DB
- func (s *DB) GetOrCreate(ctx context.Context, dest interface{}, selectQuery, insertQuery string, ...) error
- func (s *DB) InsertContext(ctx context.Context, query string, args ...interface{}) (int64, error)
- func (s *DB) InsertContextPsql(ctx context.Context, query string, args ...interface{}) (int64, error)
- func (s *DB) InsertIgnoreContext(ctx context.Context, query string, args ...interface{}) (bool, error)
- func (s *DB) UpdateContext(ctx context.Context, query string, args ...interface{}) (int64, error)
- func (s *DB) UpdateOneContext(ctx context.Context, query string, args ...interface{}) error
- type ErrorWrapper
- func (l *ErrorWrapper) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (l *ErrorWrapper) GetContext(ctx context.Context, DB interface{}, query string, args ...interface{}) error
- func (l *ErrorWrapper) InsertContext(ctx context.Context, query string, args ...interface{}) (int64, error)
- func (l *ErrorWrapper) InsertIgnoreContext(ctx context.Context, query string, args ...interface{}) (bool, error)
- func (l *ErrorWrapper) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (l *ErrorWrapper) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (l *ErrorWrapper) SelectContext(ctx context.Context, DBs interface{}, query string, args ...interface{}) error
- func (l *ErrorWrapper) UpdateContext(ctx context.Context, query string, args ...interface{}) (int64, error)
- func (l *ErrorWrapper) UpdateOneContext(ctx context.Context, query string, args ...interface{}) error
- type Logger
- func (l *Logger) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (l *Logger) GetContext(ctx context.Context, DB interface{}, query string, args ...interface{}) error
- func (l *Logger) InsertContext(ctx context.Context, query string, args ...interface{}) (int64, error)
- func (l *Logger) InsertIgnoreContext(ctx context.Context, query string, args ...interface{}) (bool, error)
- func (l *Logger) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (l *Logger) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (l *Logger) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (l *Logger) SelectContext(ctx context.Context, DBs interface{}, query string, args ...interface{}) error
- func (l *Logger) UpdateContext(ctx context.Context, query string, args ...interface{}) (int64, error)
- func (l *Logger) UpdateOneContext(ctx context.Context, query string, args ...interface{}) error
Constants ¶
View Source
const ER_DUP_ENTRY = 1062
MySQL error code for duplicate rows
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
func (*DB) GetOrCreate ¶
func (s *DB) GetOrCreate(ctx context.Context, dest interface{}, selectQuery, insertQuery string, args ...interface{}) error
GetOrCreate record using the first argument as the unique lookup key for the record and the rest for the insert
func (*DB) InsertContext ¶
func (*DB) InsertContextPsql ¶
func (s *DB) InsertContextPsql(ctx context.Context, query string, args ...interface{}) (int64, error)
InsertContextPsql inserts a single record reading RETURNING id
func (*DB) InsertIgnoreContext ¶
func (*DB) UpdateContext ¶
type ErrorWrapper ¶
type ErrorWrapper struct {
*DB
}
ErrorWrapper for database queries
func (*ErrorWrapper) ExecContext ¶
func (*ErrorWrapper) GetContext ¶
func (l *ErrorWrapper) GetContext(ctx context.Context, DB interface{}, query string, args ...interface{}) error
func (*ErrorWrapper) InsertContext ¶
func (*ErrorWrapper) InsertIgnoreContext ¶
func (*ErrorWrapper) PrepareContext ¶
func (*ErrorWrapper) QueryContext ¶
func (*ErrorWrapper) SelectContext ¶
func (l *ErrorWrapper) SelectContext(ctx context.Context, DBs interface{}, query string, args ...interface{}) error
func (*ErrorWrapper) UpdateContext ¶
func (*ErrorWrapper) UpdateOneContext ¶
func (l *ErrorWrapper) UpdateOneContext(ctx context.Context, query string, args ...interface{}) error
type Logger ¶
Logger for database queries
func (*Logger) ExecContext ¶
func (l *Logger) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
ExecContext shell
func (*Logger) GetContext ¶
func (*Logger) InsertContext ¶
func (*Logger) InsertIgnoreContext ¶
func (*Logger) PrepareContext ¶
PrepareContext shell
func (*Logger) QueryContext ¶
func (l *Logger) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryContext shell
func (*Logger) QueryRowContext ¶
QueryRowContext shell
func (*Logger) SelectContext ¶
func (*Logger) UpdateContext ¶
Click to show internal directories.
Click to hide internal directories.