postgres

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2017 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBodyEmpty = errors.New("body is empty")

ErrBodyEmpty err throw when body 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(SQL string, params ...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(SQL string, params ...interface{}) (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 ParseInsertRequest added in v0.2.0

func ParseInsertRequest(r *http.Request) (colsName string, colsValue string, values []interface{}, err error)

ParseInsertRequest create insert SQL

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 SetByRequest added in v0.2.0

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

SetByRequest create a set clause for SQL

func TablePermissions

func TablePermissions(table string, op string) bool

TablePermissions get tables permissions based in prest configuration

func Update

func Update(SQL string, params ...interface{}) (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