Documentation ¶
Index ¶
- Variables
- func AddDatabaseToPool(name string, DB *sqlx.DB)
- func ClearStmt()
- func Get() (*sqlx.DB, error)
- func GetDatabase() string
- func GetPool() *connection.Pool
- func GetQueryOperator(op string) (string, error)
- func GetURI(DBName string) string
- func Load()
- func MustGet() *sqlx.DB
- func NormalizeGroupFunction(paramValue string) (groupFuncSQL string, err error)
- func Prepare(db *sqlx.DB, SQL string) (stmt *sql.Stmt, err error)
- func PrepareTx(tx *sql.Tx, SQL string) (stmt *sql.Stmt, err error)
- func SetDatabase(name string)
- func WriteSQL(sql string, values []interface{}) (sc adapters.Scanner)
- type Postgres
- func (adapter *Postgres) BatchInsertCopy(dbname, schema, table string, keys []string, values ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) BatchInsertValues(SQL string, values ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) CountByRequest(req *http.Request) (countQuery string, err error)
- func (adapter *Postgres) DatabaseClause(req *http.Request) (query string, hasCount bool)
- func (adapter *Postgres) DatabaseOrderBy(order string, hasCount bool) (orderBy string)
- func (adapter *Postgres) DatabaseWhere(requestWhere string) (whereSyntax string)
- func (adapter *Postgres) Delete(SQL string, params ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) DeleteSQL(database string, schema string, table string) string
- func (adapter *Postgres) DeleteWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) DistinctClause(r *http.Request) (distinctQuery string, err error)
- func (adapter *Postgres) ExecuteScripts(method, sql string, values []interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) FieldsPermissions(r *http.Request, table string, op string) (fields []string, err error)
- func (adapter *Postgres) GetDatabase() string
- func (adapter *Postgres) GetScript(verb, folder, scriptName string) (script string, err error)
- func (adapter *Postgres) GetTransaction() (tx *sql.Tx, err error)
- func (adapter *Postgres) GroupByClause(r *http.Request) (groupBySQL string)
- func (adapter *Postgres) Insert(SQL string, params ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) InsertSQL(database string, schema string, table string, names string, ...) string
- func (adapter *Postgres) InsertWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) JoinByRequest(r *http.Request) (values []string, err error)
- func (adapter *Postgres) OrderByRequest(r *http.Request) (values string, err error)
- func (adapter *Postgres) PaginateIfPossible(r *http.Request) (paginatedQuery string, err error)
- func (adapter *Postgres) ParseBatchInsertRequest(r *http.Request) (colsName string, placeholders string, values []interface{}, err error)
- func (adapter *Postgres) ParseInsertRequest(r *http.Request) (colsName string, colsValue string, values []interface{}, err error)
- func (adapter *Postgres) ParseScript(scriptPath string, templateData map[string]interface{}) (sqlQuery string, values []interface{}, err error)
- func (adapter *Postgres) Query(SQL string, params ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) QueryCount(SQL string, params ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) ReturningByRequest(r *http.Request) (returningSyntax string, err error)
- func (adapter *Postgres) SchemaClause(req *http.Request) (query string, hasCount bool)
- func (adapter *Postgres) SchemaOrderBy(order string, hasCount bool) (orderBy string)
- func (adapter *Postgres) SchemaTablesClause() (query string)
- func (adapter *Postgres) SchemaTablesOrderBy(order string) (orderBy string)
- func (adapter *Postgres) SchemaTablesWhere(requestWhere string) (whereSyntax string)
- func (adapter *Postgres) SelectFields(fields []string) (sql string, err error)
- func (adapter *Postgres) SelectSQL(selectStr string, database string, schema string, table string) string
- func (adapter *Postgres) SetByRequest(r *http.Request, initialPlaceholderID int) (setSyntax string, values []interface{}, err error)
- func (adapter *Postgres) SetDatabase(name string)
- func (adapter *Postgres) ShowTable(schema, table string) adapters.Scanner
- func (adapter *Postgres) TableClause() (query string)
- func (adapter *Postgres) TableOrderBy(order string) (orderBy string)
- func (adapter *Postgres) TablePermissions(table string, op string) (access bool)
- func (adapter *Postgres) TableWhere(requestWhere string) (whereSyntax string)
- func (adapter *Postgres) Update(SQL string, params ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) UpdateSQL(database string, schema string, table string, setSyntax string) string
- func (adapter *Postgres) UpdateWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner)
- func (adapter *Postgres) WhereByRequest(r *http.Request, initialPlaceholderID int) (whereSyntax string, values []interface{}, err error)
- type Stmt
Constants ¶
This section is empty.
Variables ¶
var ErrBodyEmpty = errors.New("body is empty")
ErrBodyEmpty err throw when body is empty
Functions ¶
func AddDatabaseToPool ¶ added in v1.0.10
AddDatabaseToPool add connection to pool
func ClearStmt ¶ added in v1.0.10
func ClearStmt()
ClearStmt used to reset the cache and allow multiple tests
func GetDatabase ¶ added in v1.0.10
func GetDatabase() string
GetDatabase get current database in use
func GetQueryOperator ¶
GetQueryOperator identify operator on a join
func NormalizeGroupFunction ¶ added in v1.0.10
NormalizeGroupFunction normalize url params values to sql group functions
func SetDatabase ¶ added in v1.0.10
func SetDatabase(name string)
SetDatabase set current database in use
Types ¶
type Postgres ¶ added in v1.0.10
type Postgres struct { }
Postgres adapter postgresql
func (*Postgres) BatchInsertCopy ¶ added in v1.0.10
func (adapter *Postgres) BatchInsertCopy(dbname, schema, table string, keys []string, values ...interface{}) (sc adapters.Scanner)
BatchInsertCopy execute batch insert sql into a table unsing copy
func (*Postgres) BatchInsertValues ¶ added in v1.0.10
BatchInsertValues execute batch insert sql into a table unsing multi values
func (*Postgres) CountByRequest ¶ added in v1.0.10
CountByRequest implements COUNT(fields) OPERTATION
func (*Postgres) DatabaseClause ¶ added in v1.0.10
DatabaseClause return a SELECT `query`
func (*Postgres) DatabaseOrderBy ¶ added in v1.0.10
DatabaseOrderBy generate database order by
func (*Postgres) DatabaseWhere ¶ added in v1.0.10
DatabaseWhere generate database where syntax
func (*Postgres) DeleteWithTransaction ¶ added in v1.0.10
func (adapter *Postgres) DeleteWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner)
DeleteWithTransaction execute delete sql into a table
func (*Postgres) DistinctClause ¶ added in v1.0.10
DistinctClause get params in request to add distinct clause
func (*Postgres) ExecuteScripts ¶ added in v1.0.10
func (adapter *Postgres) ExecuteScripts(method, sql string, values []interface{}) (sc adapters.Scanner)
ExecuteScripts run sql templates created by users
func (*Postgres) FieldsPermissions ¶ added in v1.0.10
func (adapter *Postgres) FieldsPermissions(r *http.Request, table string, op string) (fields []string, err error)
FieldsPermissions get fields permissions based in prest configuration
func (*Postgres) GetDatabase ¶ added in v1.0.10
GetDatabase returns the current DB name
func (*Postgres) GetTransaction ¶ added in v1.0.10
GetTransaction get transaction
func (*Postgres) GroupByClause ¶ added in v1.0.10
GroupByClause get params in request to add group by clause
func (*Postgres) InsertSQL ¶ added in v1.0.10
func (adapter *Postgres) InsertSQL(database string, schema string, table string, names string, placeholders string) string
InsertSQL generate insert sql
func (*Postgres) InsertWithTransaction ¶ added in v1.0.10
func (adapter *Postgres) InsertWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner)
InsertWithTransaction execute insert sql into a table
func (*Postgres) JoinByRequest ¶ added in v1.0.10
JoinByRequest implements join in queries
func (*Postgres) OrderByRequest ¶ added in v1.0.10
OrderByRequest implements ORDER BY in queries
func (*Postgres) PaginateIfPossible ¶ added in v1.0.10
PaginateIfPossible func
func (*Postgres) ParseBatchInsertRequest ¶ added in v1.0.10
func (adapter *Postgres) ParseBatchInsertRequest(r *http.Request) (colsName string, placeholders string, values []interface{}, err error)
ParseBatchInsertRequest create insert SQL to batch request
func (*Postgres) ParseInsertRequest ¶ added in v1.0.10
func (adapter *Postgres) ParseInsertRequest(r *http.Request) (colsName string, colsValue string, values []interface{}, err error)
ParseInsertRequest create insert SQL
func (*Postgres) ParseScript ¶ added in v1.0.10
func (adapter *Postgres) ParseScript(scriptPath string, templateData map[string]interface{}) (sqlQuery string, values []interface{}, err error)
ParseScript use values sent by users and add on script
func (*Postgres) QueryCount ¶ added in v1.0.10
QueryCount process queries with count
func (*Postgres) ReturningByRequest ¶ added in v1.0.10
ReturningByRequest create interface for queries + returning
func (*Postgres) SchemaClause ¶ added in v1.0.10
SchemaClause return a SELECT `query`
func (*Postgres) SchemaOrderBy ¶ added in v1.0.10
SchemaOrderBy generate schema order by
func (*Postgres) SchemaTablesClause ¶ added in v1.0.10
SchemaTablesClause generate schema tables clause
func (*Postgres) SchemaTablesOrderBy ¶ added in v1.0.10
SchemaTablesOrderBy generate schema tables order by
func (*Postgres) SchemaTablesWhere ¶ added in v1.0.10
SchemaTablesWhere generate schema tables where syntax
func (*Postgres) SelectFields ¶ added in v1.0.10
SelectFields query
func (*Postgres) SelectSQL ¶ added in v1.0.10
func (adapter *Postgres) SelectSQL(selectStr string, database string, schema string, table string) string
SelectSQL generate select sql
func (*Postgres) SetByRequest ¶ added in v1.0.10
func (adapter *Postgres) SetByRequest(r *http.Request, initialPlaceholderID int) (setSyntax string, values []interface{}, err error)
SetByRequest create a set clause for SQL
func (*Postgres) SetDatabase ¶ added in v1.0.10
SetDatabase set the current database name in use
func (*Postgres) TableClause ¶ added in v1.0.10
TableClause generate table clause
func (*Postgres) TableOrderBy ¶ added in v1.0.10
TableOrderBy generate table order by
func (*Postgres) TablePermissions ¶ added in v1.0.10
TablePermissions get tables permissions based in prest configuration
func (*Postgres) TableWhere ¶ added in v1.0.10
TableWhere generate table where syntax
func (*Postgres) UpdateSQL ¶ added in v1.0.10
func (adapter *Postgres) UpdateSQL(database string, schema string, table string, setSyntax string) string
UpdateSQL generate update sql