Documentation ¶
Index ¶
- func DeleteOne(db Rootx, sqlKey string, args ...interface{}) error
- func Exec(db Rootx, sqlKey string, args ...interface{}) error
- func Exists(db Rootx, sqlKey string, args ...interface{}) (bool, error)
- func Insert(db Rootx, sqlKey string, args ...interface{}) (int64, error)
- func InsertPsql(db Rootx, sqlKey string, args ...interface{}) (int64, error)
- func ScanOne(instance interface{}, rows *sqlx.Rows) error
- func SelectAll(db Rootx, sqlKey string, instances interface{}, args ...interface{}) error
- func SelectOne(db Rootx, sqlKey string, instance interface{}, args ...interface{}) error
- func UpdateOne(db Rootx, sqlKey string, args ...interface{}) error
- type Error
- type Rootx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertPsql ¶
InsertPsql inserts a single instance
Types ¶
type Error ¶
Error defines an error that can occur in Rootx helper methods.
This is useful to inspect the specific key an error occurred on.
type Rootx ¶
type Rootx interface { SQL(key string) (query string) Exec(query string, args ...interface{}) (sql.Result, error) QueryRow(query string, args ...interface{}) *sql.Row Queryx(query string, args ...interface{}) (*sqlx.Rows, error) Select(instances interface{}, query string, args ...interface{}) error Get(instance interface{}, query string, args ...interface{}) error }
Rootx defines an interface that needs to be implemented to take advantage of the Rootx helper methods.
With the exception of SQL, which is used to get SQL queries by key, these are provided by github.com/jmoiron/sqlx's DB and TX.
Click to show internal directories.
Click to hide internal directories.