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) 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, queryURL url.Values) (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) TableClause() (query string)
- func (adapter *Postgres) TableOrderBy(order string) (orderBy string)
- func (adapter *Postgres) TablePermissions(table string, op string) 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 ¶
AddDatabaseToPool add connection to pool
func GetQueryOperator ¶
GetQueryOperator identify operator on a join
func NormalizeGroupFunction ¶
NormalizeGroupFunction normalize url params values to sql group functions
Types ¶
type Postgres ¶
type Postgres struct { }
Postgres adapter postgresql
func (*Postgres) BatchInsertCopy ¶
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 ¶
BatchInsertValues execute batch insert sql into a table unsing multi values
func (*Postgres) CountByRequest ¶
CountByRequest implements COUNT(fields) OPERTATION
func (*Postgres) DatabaseClause ¶
DatabaseClause return a SELECT `query`
func (*Postgres) DatabaseOrderBy ¶
DatabaseOrderBy generate database order by
func (*Postgres) DatabaseWhere ¶
DatabaseWhere generate database where syntax
func (*Postgres) DeleteWithTransaction ¶
func (adapter *Postgres) DeleteWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner)
DeleteWithTransaction execute delete sql into a table
func (*Postgres) DistinctClause ¶
DistinctClause get params in request to add distinct clause
func (*Postgres) ExecuteScripts ¶
func (adapter *Postgres) ExecuteScripts(method, sql string, values []interface{}) (sc adapters.Scanner)
ExecuteScripts run sql templates created by users
func (*Postgres) FieldsPermissions ¶
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) GetTransaction ¶
GetTransaction get transaction
func (*Postgres) GroupByClause ¶
GroupByClause get params in request to add group by clause
func (*Postgres) InsertSQL ¶
func (adapter *Postgres) InsertSQL(database string, schema string, table string, names string, placeholders string) string
InsertSQL generate insert sql
func (*Postgres) InsertWithTransaction ¶
func (adapter *Postgres) InsertWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner)
InsertWithTransaction execute insert sql into a table
func (*Postgres) JoinByRequest ¶
JoinByRequest implements join in queries
func (*Postgres) OrderByRequest ¶
OrderByRequest implements ORDER BY in queries
func (*Postgres) PaginateIfPossible ¶
PaginateIfPossible func
func (*Postgres) ParseBatchInsertRequest ¶
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 ¶
func (adapter *Postgres) ParseInsertRequest(r *http.Request) (colsName string, colsValue string, values []interface{}, err error)
ParseInsertRequest create insert SQL
func (*Postgres) ParseScript ¶
func (adapter *Postgres) ParseScript(scriptPath string, queryURL url.Values) (sqlQuery string, values []interface{}, err error)
ParseScript use values sent by users and add on script
func (*Postgres) QueryCount ¶
QueryCount process queries with count
func (*Postgres) ReturningByRequest ¶
ReturningByRequest create interface for queries + returning
func (*Postgres) SchemaClause ¶
SchemaClause return a SELECT `query`
func (*Postgres) SchemaOrderBy ¶
SchemaOrderBy generate schema order by
func (*Postgres) SchemaTablesClause ¶
SchemaTablesClause generate schema tables clause
func (*Postgres) SchemaTablesOrderBy ¶
SchemaTablesOrderBy generate schema tables order by
func (*Postgres) SchemaTablesWhere ¶
SchemaTablesWhere generate schema tables where syntax
func (*Postgres) SelectFields ¶
SelectFields query
func (*Postgres) SelectSQL ¶
func (adapter *Postgres) SelectSQL(selectStr string, database string, schema string, table string) string
SelectSQL generate select sql
func (*Postgres) SetByRequest ¶
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 ¶
SetDatabase set the current database name in use
func (*Postgres) TableClause ¶
TableClause generate table clause
func (*Postgres) TableOrderBy ¶
TableOrderBy generate table order by
func (*Postgres) TablePermissions ¶
TablePermissions get tables permissions based in prest configuration
func (*Postgres) TableWhere ¶
TableWhere generate table where syntax
func (*Postgres) UpdateSQL ¶
func (adapter *Postgres) UpdateSQL(database string, schema string, table string, setSyntax string) string
UpdateSQL generate update sql