Documentation ¶
Index ¶
- Variables
- func BindVar(i int) string
- func Delete(exec Conn, list ...interface{}) (int64, error)
- func Exec(conn Conn, query string, args ...interface{}) (sql.Result, error)
- func FullMatch(v interface{}) string
- func Insert(exec Conn, list ...interface{}) error
- func MultiExec(e sqlx.Execer, query string) error
- func MultiExecFromFile(e sqlx.Execer, filename string) error
- func PreMatch(v interface{}) string
- func Prepare(conn Conn, query string) (*sqlx.Stmt, error)
- func PrepareIN(n int) string
- func PrepareIntIN(args *[]interface{}, w *[]string, value interface{}, table, field string) error
- func PrepareWhere(w []string) string
- func Put(exec Conn, isNew bool, list ...interface{}) error
- func QueryRowx(conn Conn, query string, args ...interface{}) (*sqlx.Row, error)
- func Queryx(conn Conn, query string, args ...interface{}) (*sqlx.Rows, error)
- func QuoteField(f string) string
- func Scalar(conn Conn, query string, args ...interface{}) (int64, error)
- func Select(exec Conn, dest interface{}, query string, args ...interface{}) error
- func SnakeCaseConverter(col string) string
- func StmtClose(conn Conn, stmt *sqlx.Stmt) error
- func SuffixMatch(v interface{}) string
- func Update(exec Conn, list ...interface{}) (int64, error)
- type Args
- type ColumnMap
- type Conn
- type DB
- type DbMap
- type NoKeysErr
- type NullTime
- type TableMap
Constants ¶
This section is empty.
Variables ¶
var ErrNoRows = sql.ErrNoRows
Functions ¶
func PrepareIntIN ¶
func PrepareWhere ¶
func QuoteField ¶
func SnakeCaseConverter ¶
func SuffixMatch ¶
func SuffixMatch(v interface{}) string
Types ¶
type ColumnMap ¶
type ColumnMap struct { // Column name in db table ColumnName string // If true, this column is skipped in generated SQL statements Transient bool // If true, " unique" is added to create table statements. Unique bool // Passed to Dialect.ToSqlType() to assist in informing the // correct column type to map to in CreateTables() MaxSize int // contains filtered or unexported fields }
ColumnMap represents a mapping between a Go struct field and a single column in a table. Unique and MaxSize only inform the CreateTables() function and are not used for validation by Insert/Update/Delete/Get.
func (*ColumnMap) SetTransient ¶
SetTransient allows you to mark the column as transient. If true this column will be skipped when SQL statements are generated
type DbMap ¶
type DbMap struct {
// contains filtered or unexported fields
}
var DefaultDBMap *DbMap
func (*DbMap) AddTable ¶
AddTable registers the given interface type with modl. The table name will be given the name of the TypeOf(i), lowercased.
This operation is idempotent. If i's type is already mapped, the existing *TableMap is returned
func (*DbMap) AddTableWithName ¶
type TableMap ¶
type TableMap struct { // Name of database table. TableName string // contains filtered or unexported fields }
TableMap represents a mapping between a Go struct and a database table Use dbmap.AddTable() or dbmap.AddTableWithName() to create these
func (*TableMap) ColMap ¶
ColMap returns the ColumnMap pointer matching the given struct field name. It panics if the struct does not contain a field matching this name.
func (*TableMap) ColumnsStr ¶
func (*TableMap) ResetSql ¶
func (t *TableMap) ResetSql()
ResetSql removes cached insert/update/select/delete SQL strings associated with this TableMap. Call this if you've modified any column names or the table name itself.
func (*TableMap) SetKeys ¶
SetKeys lets you specify the fields on a struct that map to primary key columns on the table. If isAutoIncr is set, result.LastInsertId() will be used after INSERT to bind the generated id to the Go struct.
Automatically calls ResetSql() to ensure SQL statements are regenerated.