postgres

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2017 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnsByRequest

func ColumnsByRequest(r *http.Request) []string

ColumnsByRequest extract columns and return as array of strings

func CountByRequest

func CountByRequest(req *http.Request) (countQuery string, err error)

CountByRequest implements COUNT(fields) OPERTATION

func DatabaseClause

func DatabaseClause(req *http.Request) (query string, hasCount bool)

DatabaseClause return a SELECT `query`

func Delete

func Delete(database, schema, table, where string, whereValues []interface{}) (jsonData []byte, err error)

Delete execute delete sql into a table

func ExecuteScripts

func ExecuteScripts(method, sql string, values []interface{}) (result []byte, err error)

ExecuteScripts run sql templates created by users

func FieldsPermissions

func FieldsPermissions(table string, cols []string, op string) []string

FieldsPermissions get fields permissions based in prest configuration

func GetQueryOperator

func GetQueryOperator(op string) (string, error)

GetQueryOperator identify operator on a join

func GetScript

func GetScript(verb, folder, scriptName string) (script string, err error)

GetScript get SQL template file

func Insert

func Insert(database, schema, table string, body api.Request) (jsonData []byte, err error)

Insert execute insert sql into a table

func JoinByRequest

func JoinByRequest(r *http.Request) (values []string, err error)

JoinByRequest implements join in queries

func OrderByRequest

func OrderByRequest(r *http.Request) (values string, err error)

OrderByRequest implements ORDER BY in queries

func PaginateIfPossible

func PaginateIfPossible(r *http.Request) (paginatedQuery string, err error)

PaginateIfPossible func

func ParseScript

func ParseScript(scriptPath string, queryURL url.Values) (sqlQuery string, values []interface{}, err error)

ParseScript use values sent by users and add on script

func Query

func Query(SQL string, params ...interface{}) (jsonData []byte, err error)

Query process queries

func QueryCount

func QueryCount(SQL string, params ...interface{}) ([]byte, error)

QueryCount process queries with count

func SchemaClause

func SchemaClause(req *http.Request) (query string, hasCount bool)

SchemaClause return a SELECT `query`

func SelectFields

func SelectFields(fields []string) (sql string, err error)

SelectFields query

func TablePermissions

func TablePermissions(table string, op string) bool

TablePermissions get tables permissions based in prest configuration

func Update

func Update(database, schema, table, where string, whereValues []interface{}, body api.Request) (jsonData []byte, err error)

Update execute update sql into a table

func WhereByRequest

func WhereByRequest(r *http.Request, initialPlaceholderID int) (whereSyntax string, values []interface{}, err error)

WhereByRequest create interface for queries + where

func WriteSQL

func WriteSQL(sql string, values []interface{}) (resultByte []byte, err error)

WriteSQL perform INSERT's, UPDATE's, DELETE's operations

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL