Versions in this module Expand all Collapse all v3 v3.0.2 Dec 4, 2019 Changes in this version + func NonFatalError(err error) bool + func SelectFloat(e SqlExecutor, query string, args ...interface{}) (float64, error) + func SelectInt(e SqlExecutor, query string, args ...interface{}) (int64, error) + func SelectNullFloat(e SqlExecutor, query string, args ...interface{}) (sql.NullFloat64, error) + func SelectNullInt(e SqlExecutor, query string, args ...interface{}) (sql.NullInt64, error) + func SelectNullStr(e SqlExecutor, query string, args ...interface{}) (sql.NullString, error) + func SelectOne(m *DbMap, e SqlExecutor, holder interface{}, query string, args ...interface{}) error + func SelectStr(e SqlExecutor, query string, args ...interface{}) (string, error) + type ColumnFilter func(*ColumnMap) bool + type ColumnMap struct + ColumnName string + DefaultValue string + GeneratedIdQuery string + MaxSize int + Transient bool + Unique bool + func (c *ColumnMap) Rename(colname string) *ColumnMap + func (c *ColumnMap) SetMaxSize(size int) *ColumnMap + func (c *ColumnMap) SetNotNull(nn bool) *ColumnMap + func (c *ColumnMap) SetTransient(b bool) *ColumnMap + func (c *ColumnMap) SetUnique(b bool) *ColumnMap + type CustomScanner struct + Binder func(holder interface{}, target interface{}) error + Holder interface{} + Target interface{} + func (me CustomScanner) Bind() error + type DbMap struct + Db *sql.DB + Dialect Dialect + ExpandSliceArgs bool + TypeConverter TypeConverter + func (m *DbMap) AddTable(i interface{}) *TableMap + func (m *DbMap) AddTableDynamic(inp DynamicTable, schema string) *TableMap + func (m *DbMap) AddTableWithName(i interface{}, name string) *TableMap + func (m *DbMap) AddTableWithNameAndSchema(i interface{}, schema string, name string) *TableMap + func (m *DbMap) Begin() (*Transaction, error) + func (m *DbMap) CreateIndex() error + func (m *DbMap) CreateTables() error + func (m *DbMap) CreateTablesIfNotExists() error + func (m *DbMap) Delete(list ...interface{}) (int64, error) + func (m *DbMap) DropTable(table interface{}) error + func (m *DbMap) DropTableIfExists(table interface{}) error + func (m *DbMap) DropTables() error + func (m *DbMap) DropTablesIfExists() error + func (m *DbMap) DynamicTableFor(tableName string, checkPK bool) (*TableMap, error) + func (m *DbMap) Exec(query string, args ...interface{}) (sql.Result, error) + func (m *DbMap) Get(i interface{}, keys ...interface{}) (interface{}, error) + func (m *DbMap) Insert(list ...interface{}) error + func (m *DbMap) Prepare(query string) (*sql.Stmt, error) + func (m *DbMap) Query(q string, args ...interface{}) (*sql.Rows, error) + func (m *DbMap) QueryRow(query string, args ...interface{}) *sql.Row + func (m *DbMap) Select(i interface{}, query string, args ...interface{}) ([]interface{}, error) + func (m *DbMap) SelectFloat(query string, args ...interface{}) (float64, error) + func (m *DbMap) SelectInt(query string, args ...interface{}) (int64, error) + func (m *DbMap) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) + func (m *DbMap) SelectNullInt(query string, args ...interface{}) (sql.NullInt64, error) + func (m *DbMap) SelectNullStr(query string, args ...interface{}) (sql.NullString, error) + func (m *DbMap) SelectOne(holder interface{}, query string, args ...interface{}) error + func (m *DbMap) SelectStr(query string, args ...interface{}) (string, error) + func (m *DbMap) TableFor(t reflect.Type, checkPK bool) (*TableMap, error) + func (m *DbMap) TraceOff() + func (m *DbMap) TraceOn(prefix string, logger GorpLogger) + func (m *DbMap) TruncateTables() error + func (m *DbMap) Update(list ...interface{}) (int64, error) + func (m *DbMap) UpdateColumns(filter ColumnFilter, list ...interface{}) (int64, error) + func (m *DbMap) WithContext(ctx context.Context) SqlExecutor + type Dialect interface + AutoIncrBindValue func() string + AutoIncrInsertInfix func(col *ColumnMap) string + AutoIncrInsertSuffix func(col *ColumnMap) string + AutoIncrStr func() string + BindVar func(i int) string + CreateIndexSuffix func() string + CreateTableSuffix func() string + DropIndexSuffix func() string + IfSchemaNotExists func(command, schema string) string + IfTableExists func(command, schema, table string) string + IfTableNotExists func(command, schema, table string) string + QuerySuffix func() string + QuoteField func(field string) string + QuotedTableForQuery func(schema string, table string) string + ToSqlType func(val reflect.Type, maxsize int, isAutoIncr bool) string + TruncateClause func() string + type DynamicTable interface + SetTableName func(string) + TableName func() string + type GorpLogger interface + Printf func(format string, v ...interface{}) + type HasPostDelete interface + PostDelete func(SqlExecutor) error + type HasPostGet interface + PostGet func(SqlExecutor) error + type HasPostInsert interface + PostInsert func(SqlExecutor) error + type HasPostUpdate interface + PostUpdate func(SqlExecutor) error + type HasPreDelete interface + PreDelete func(SqlExecutor) error + type HasPreInsert interface + PreInsert func(SqlExecutor) error + type HasPreUpdate interface + PreUpdate func(SqlExecutor) error + type IndexMap struct + IndexName string + IndexType string + Unique bool + func (idx *IndexMap) Rename(indname string) *IndexMap + func (idx *IndexMap) SetIndexType(indtype string) *IndexMap + func (idx *IndexMap) SetUnique(b bool) *IndexMap + type IntegerAutoIncrInserter interface + InsertAutoIncr func(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error) + type MySQLDialect struct + Encoding string + Engine string + func (d MySQLDialect) AutoIncrBindValue() string + func (d MySQLDialect) AutoIncrInsertInfix(col *ColumnMap) string + func (d MySQLDialect) AutoIncrInsertSuffix(col *ColumnMap) string + func (d MySQLDialect) AutoIncrStr() string + func (d MySQLDialect) BindVar(i int) string + func (d MySQLDialect) CreateIndexSuffix() string + func (d MySQLDialect) CreateTableSuffix() string + func (d MySQLDialect) DropIndexSuffix() string + func (d MySQLDialect) IfSchemaNotExists(command, schema string) string + func (d MySQLDialect) IfTableExists(command, schema, table string) string + func (d MySQLDialect) IfTableNotExists(command, schema, table string) string + func (d MySQLDialect) InsertAutoIncr(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error) + func (d MySQLDialect) QuerySuffix() string + func (d MySQLDialect) QuoteField(f string) string + func (d MySQLDialect) QuotedTableForQuery(schema string, table string) string + func (d MySQLDialect) SleepClause(s time.Duration) string + func (d MySQLDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string + func (d MySQLDialect) TruncateClause() string + type NoFieldInTypeError struct + MissingColNames []string + TypeName string + func (err *NoFieldInTypeError) Error() string + type NullTime struct + Time time.Time + Valid bool + func (nt *NullTime) Scan(value interface{}) error + func (nt NullTime) Value() (driver.Value, error) + type OptimisticLockError struct + Keys []interface{} + LocalVersion int64 + RowExists bool + TableName string + func (e OptimisticLockError) Error() string + type OracleDialect struct + func (d OracleDialect) AutoIncrBindValue() string + func (d OracleDialect) AutoIncrInsertInfix(col *ColumnMap) string + func (d OracleDialect) AutoIncrInsertSuffix(col *ColumnMap) string + func (d OracleDialect) AutoIncrStr() string + func (d OracleDialect) BindVar(i int) string + func (d OracleDialect) CreateIndexSuffix() string + func (d OracleDialect) CreateTableSuffix() string + func (d OracleDialect) DropIndexSuffix() string + func (d OracleDialect) IfSchemaNotExists(command, schema string) string + func (d OracleDialect) IfTableExists(command, schema, table string) string + func (d OracleDialect) IfTableNotExists(command, schema, table string) string + func (d OracleDialect) InsertQueryToTarget(exec SqlExecutor, insertSql, idSql string, target interface{}, ...) error + func (d OracleDialect) QuerySuffix() string + func (d OracleDialect) QuoteField(f string) string + func (d OracleDialect) QuotedTableForQuery(schema string, table string) string + func (d OracleDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string + func (d OracleDialect) TruncateClause() string + type OracleString struct + func (os *OracleString) Scan(value interface{}) error + func (os OracleString) Value() (driver.Value, error) + type PostgresDialect struct + LowercaseFields bool + func (d PostgresDialect) AutoIncrBindValue() string + func (d PostgresDialect) AutoIncrInsertInfix(col *ColumnMap) string + func (d PostgresDialect) AutoIncrInsertSuffix(col *ColumnMap) string + func (d PostgresDialect) AutoIncrStr() string + func (d PostgresDialect) BindVar(i int) string + func (d PostgresDialect) CreateIndexSuffix() string + func (d PostgresDialect) CreateTableSuffix() string + func (d PostgresDialect) DropIndexSuffix() string + func (d PostgresDialect) IfSchemaNotExists(command, schema string) string + func (d PostgresDialect) IfTableExists(command, schema, table string) string + func (d PostgresDialect) IfTableNotExists(command, schema, table string) string + func (d PostgresDialect) InsertAutoIncrToTarget(exec SqlExecutor, insertSql string, target interface{}, params ...interface{}) error + func (d PostgresDialect) QuerySuffix() string + func (d PostgresDialect) QuoteField(f string) string + func (d PostgresDialect) QuotedTableForQuery(schema string, table string) string + func (d PostgresDialect) SleepClause(s time.Duration) string + func (d PostgresDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string + func (d PostgresDialect) TruncateClause() string + type SqlExecutor interface + Delete func(list ...interface{}) (int64, error) + Exec func(query string, args ...interface{}) (sql.Result, error) + Get func(i interface{}, keys ...interface{}) (interface{}, error) + Insert func(list ...interface{}) error + Query func(query string, args ...interface{}) (*sql.Rows, error) + QueryRow func(query string, args ...interface{}) *sql.Row + Select func(i interface{}, query string, args ...interface{}) ([]interface{}, error) + SelectFloat func(query string, args ...interface{}) (float64, error) + SelectInt func(query string, args ...interface{}) (int64, error) + SelectNullFloat func(query string, args ...interface{}) (sql.NullFloat64, error) + SelectNullInt func(query string, args ...interface{}) (sql.NullInt64, error) + SelectNullStr func(query string, args ...interface{}) (sql.NullString, error) + SelectOne func(holder interface{}, query string, args ...interface{}) error + SelectStr func(query string, args ...interface{}) (string, error) + Update func(list ...interface{}) (int64, error) + WithContext func(ctx context.Context) SqlExecutor + type SqlServerDialect struct + Version string + func (d SqlServerDialect) AutoIncrBindValue() string + func (d SqlServerDialect) AutoIncrInsertInfix(col *ColumnMap) string + func (d SqlServerDialect) AutoIncrInsertSuffix(col *ColumnMap) string + func (d SqlServerDialect) AutoIncrStr() string + func (d SqlServerDialect) BindVar(i int) string + func (d SqlServerDialect) CreateIndexSuffix() string + func (d SqlServerDialect) CreateTableSuffix() string + func (d SqlServerDialect) DropIndexSuffix() string + func (d SqlServerDialect) IfSchemaNotExists(command, schema string) string + func (d SqlServerDialect) IfTableExists(command, schema, table string) string + func (d SqlServerDialect) IfTableNotExists(command, schema, table string) string + func (d SqlServerDialect) InsertAutoIncr(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error) + func (d SqlServerDialect) QuerySuffix() string + func (d SqlServerDialect) QuoteField(f string) string + func (d SqlServerDialect) QuotedTableForQuery(schema string, table string) string + func (d SqlServerDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string + func (d SqlServerDialect) TruncateClause() string + type SqlTyper interface + SqlType func() driver.Value + type SqliteDialect struct + func (d SqliteDialect) AutoIncrBindValue() string + func (d SqliteDialect) AutoIncrInsertInfix(col *ColumnMap) string + func (d SqliteDialect) AutoIncrInsertSuffix(col *ColumnMap) string + func (d SqliteDialect) AutoIncrStr() string + func (d SqliteDialect) BindVar(i int) string + func (d SqliteDialect) CreateIndexSuffix() string + func (d SqliteDialect) CreateTableSuffix() string + func (d SqliteDialect) DropIndexSuffix() string + func (d SqliteDialect) IfSchemaNotExists(command, schema string) string + func (d SqliteDialect) IfTableExists(command, schema, table string) string + func (d SqliteDialect) IfTableNotExists(command, schema, table string) string + func (d SqliteDialect) InsertAutoIncr(exec SqlExecutor, insertSql string, params ...interface{}) (int64, error) + func (d SqliteDialect) QuerySuffix() string + func (d SqliteDialect) QuoteField(f string) string + func (d SqliteDialect) QuotedTableForQuery(schema string, table string) string + func (d SqliteDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string + func (d SqliteDialect) TruncateClause() string + type TableMap struct + Columns []*ColumnMap + SchemaName string + TableName string + func (t *TableMap) AddIndex(name string, idxtype string, columns []string) *IndexMap + func (t *TableMap) ColMap(field string) *ColumnMap + func (t *TableMap) DropIndex(name string) error + func (t *TableMap) IdxMap(field string) *IndexMap + func (t *TableMap) ResetSql() + func (t *TableMap) SetKeys(isAutoIncr bool, fieldNames ...string) *TableMap + func (t *TableMap) SetUniqueTogether(fieldNames ...string) *TableMap + func (t *TableMap) SetVersionCol(field string) *ColumnMap + func (t *TableMap) SqlForCreate(ifNotExists bool) string + type TargetQueryInserter interface + InsertQueryToTarget func(exec SqlExecutor, insertSql, idSql string, target interface{}, ...) error + type TargetedAutoIncrInserter interface + InsertAutoIncrToTarget func(exec SqlExecutor, insertSql string, target interface{}, params ...interface{}) error + type Transaction struct + func (t *Transaction) Commit() error + func (t *Transaction) Delete(list ...interface{}) (int64, error) + func (t *Transaction) Exec(query string, args ...interface{}) (sql.Result, error) + func (t *Transaction) Get(i interface{}, keys ...interface{}) (interface{}, error) + func (t *Transaction) Insert(list ...interface{}) error + func (t *Transaction) Prepare(query string) (*sql.Stmt, error) + func (t *Transaction) Query(q string, args ...interface{}) (*sql.Rows, error) + func (t *Transaction) QueryRow(query string, args ...interface{}) *sql.Row + func (t *Transaction) ReleaseSavepoint(savepoint string) error + func (t *Transaction) Rollback() error + func (t *Transaction) RollbackToSavepoint(savepoint string) error + func (t *Transaction) Savepoint(name string) error + func (t *Transaction) Select(i interface{}, query string, args ...interface{}) ([]interface{}, error) + func (t *Transaction) SelectFloat(query string, args ...interface{}) (float64, error) + func (t *Transaction) SelectInt(query string, args ...interface{}) (int64, error) + func (t *Transaction) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) + func (t *Transaction) SelectNullInt(query string, args ...interface{}) (sql.NullInt64, error) + func (t *Transaction) SelectNullStr(query string, args ...interface{}) (sql.NullString, error) + func (t *Transaction) SelectOne(holder interface{}, query string, args ...interface{}) error + func (t *Transaction) SelectStr(query string, args ...interface{}) (string, error) + func (t *Transaction) Update(list ...interface{}) (int64, error) + func (t *Transaction) UpdateColumns(filter ColumnFilter, list ...interface{}) (int64, error) + func (t *Transaction) WithContext(ctx context.Context) SqlExecutor + type TypeConverter interface + FromDb func(target interface{}) (CustomScanner, bool) + ToDb func(val interface{}) (interface{}, error) Other modules containing this package github.com/birlesikodeme/gorp