sql

package
v0.0.0-...-b28dd9f Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintOne

func PrintOne(colNames []string, rows *sql.Rows,
	w http.ResponseWriter)

PrintOne : function to print one row from a table

func ProcessStr

func ProcessStr(str string) string

ProcessStr : format the str to match sql request

Types

type JwtToken

type JwtToken struct {
	Token string `json:"token"`
}

JwtToken : jwt struct

type SQL

type SQL struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

SQL :

func (*SQL) Connect

func (db *SQL) Connect(config *core.Config)

Connect : connect the database

func (*SQL) Delete

func (db *SQL) Delete(w http.ResponseWriter, r *http.Request)

Delete : delete entry from table

func (*SQL) Insert

func (db *SQL) Insert(w http.ResponseWriter, r *http.Request)

Insert : insert value in table

func (*SQL) Login

func (db *SQL) Login(w http.ResponseWriter, r *http.Request)

Login :

func (*SQL) Register

func (db *SQL) Register(handlers *core.Handlers)

Register : register the functions to handler map

func (*SQL) Select

func (db *SQL) Select(w http.ResponseWriter, r *http.Request)

Select : Select entry from table ** {GET} /sql/{table}/ ** ** {table} in the URL indicate which table to select in (mandatory) ** ** | NAME | TYPE | DESCRIPTION | EXAMPLE ** @apiParam | field | Array[string] | field to select | field=id ** @apiParam | ijoin | Array[string] | inner join tables | ijoin=table2-id-id ** -> ijoin={table_to_join}-{field_table_to_join}-{field_current_table} ** @apiParam | ojoin | Array[string] | outer join tables | ojoin=table2-id-id ** @apiParam | order | Array[string] | fields used to sort | order=date ** @apiParam | desc | Bool | order by descending if true | desc=true ** @apiParam | where | Array[string] | select only matching param | where=id=1 ** @apiParam | offset | Int | offset (default: 0) | offset=10 ** @apiParam | limit | Int | limit (default: 20) | limit=40

func (*SQL) Show

func (db *SQL) Show(w http.ResponseWriter, r *http.Request)

Show : describe a table

func (*SQL) Status

func (db *SQL) Status(w http.ResponseWriter, r *http.Request)

Status : print the status of the database as plain text

func (*SQL) Update

func (db *SQL) Update(w http.ResponseWriter, r *http.Request)

Update : update value in row

Jump to

Keyboard shortcuts

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