examples

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(h *network.NetHandler)

Types

type Completer

type Completer interface {
	/*
	 *	set update data
	 * 	m equals struct matching db relation
	 */
	Set(m map[string]interface{}) Completer
	/*
	 * 	execute non returning query like update and delete
	 */
	Apply() error
	/*
	 * 	execute select or queries returning many rows
	 */
	Many(i interface{}) error
	/*
	 * 	execute select scan into provided interface
	 */
	One(i interface{}) error
	/*
	 *	where condition
	 *	could be map[string]interface{} or []map[string]interface{}
	 *  e.g. map[string]interface{ "id": 1 }
	 */
	Where(any) Completer
	/*
	 * 	perform query for values in list
	 */
	In(field string, values []interface{}) Completer
}

type Food

type Food struct {
	Name string `json:"name"`
}

type Query

type Query struct {
	Conn *sql.DB
}

func (Query) Create

func (q Query) Create(name string, definition ...string) error

create table

func (Query) Delete

func (q Query) Delete(i interface{}) Completer

delete data

func (Query) Find

func (q Query) Find(i interface{}) Completer

find data from relation

func (Query) FindAll

func (q Query) FindAll(i interface{}) ([]map[string]interface{}, error)

find all from relation

func (Query) Insert

func (q Query) Insert(i interface{}) error

insert into table

func (Query) Update

func (q Query) Update(i interface{}) Completer

update table

Jump to

Keyboard shortcuts

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