db

package
v0.0.0-...-990120d Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2018 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatabaseConnect

func DatabaseConnect() *sqlx.DB

DatabaseConnect loads connection strings from the config file and connects to the specified DB

Types

type Database

type Database struct {
	Conn *sqlx.DB
}

Database holds the db connection and sould implement support for creation, retrieval, adding, updating and deleting

func (Database) CreateSchema

func (db Database) CreateSchema(k string, props map[string]*openapi3.SchemaRef)

CreateSchema generates a creation string from a model and executes

func (Database) DeleteModel

func (db Database) DeleteModel(id string, modelName string, r *http.Request) utils.JSONResponse

DeleteModel removes an existing entry

func (Database) GetModels

func (db Database) GetModels(model string) utils.JSONResponse

GetModels queries a table of a model and returns all those that match

func (Database) PostModel

func (db Database) PostModel(modelName string, model *openapi3.SchemaRef, r *http.Request) utils.JSONResponse

PostModel finds the model to be created and inserts the record

func (Database) PutModel

func (db Database) PutModel(id string, modelName string, model *openapi3.SchemaRef, r *http.Request) utils.JSONResponse

PutModel updates an existing entry

Jump to

Keyboard shortcuts

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