server

package
v0.0.0-...-b6fb7af Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_COLUMNS = "rowid as _rowid, _created_at, _updated_at"
)

Variables

This section is empty.

Functions

func CSVToHeader

func CSVToHeader(reader io.Reader) []string

func CSVToMap

func CSVToMap(reader io.Reader) []map[string]string

CSVToMap takes a reader and returns an array of dictionaries, using the header row as the keys

func Connect

func Connect(db_path string) (*sql.DB, error)

Connect function

func Connectx

func Connectx(db_path string) (*sqlx.DB, error)

Connect function

func CreateTableTemplate

func CreateTableTemplate(name string, headers []string) string

func CreateTriggers

func CreateTriggers(dbName string) string

func DefineStruct

func DefineStruct(dbName string, fields *[]map[string]interface{}) dynamicstruct.DynamicStruct

func GetColumnData

func GetColumnData(dbFile, dbName string) (*sqlx.Rows, error)

func GetDB

func GetDB(dbName string) string

func GetStruct

func GetStruct(dbFile, dbName string) dynamicstruct.DynamicStruct

func Insert

func Insert(dbFile string, dbName string, insertValues map[string]interface{}) (sql.Result, error)

func Query

func Query(dbFile string, dbName string, values JSONAPIFilter, fields JSONAPIField) (*sqlx.Rows, error)

func RowsToJSON

func RowsToJSON(rows *sqlx.Rows) *[]map[string]interface{}

func RowsToJSONApiResponse

func RowsToJSONApiResponse(dbFile, dbName string, rows *sqlx.Rows, results *JSONAPIResponse)

func Start

func Start()

func UnmarshalStruct

func UnmarshalStruct(rows *sqlx.Rows, retResults *JSONAPIResponse, _struct dynamicstruct.DynamicStruct)

func Update

func Update(dbFile string, dbName string, values JSONAPIFilter, updatedValues map[string]interface{})

func WriteJSONApiResponse

func WriteJSONApiResponse(c *fiber.Ctx, results *JSONAPIResponse)

Types

type JSONAPI

type JSONAPI struct {
	// Page  map[string][]string `form:"page"`
	Field  JSONAPIField  `form:"fields"`
	Filter JSONAPIFilter `form:"filter"`
}

type JSONAPIField

type JSONAPIField map[string][]string

type JSONAPIFilter

type JSONAPIFilter map[string][]string

type JSONAPIResponse

type JSONAPIResponse []interface{}

func QueryAPIResonse

func QueryAPIResonse(dbFile, dbName string, values JSONAPIFilter, fields JSONAPIField) (*JSONAPIResponse, error)

type StructCache

type StructCache *shardmap.Map

type StructCache *map[string]dynamicstruct.DynamicStruct

func NewStructCache

func NewStructCache() StructCache

Jump to

Keyboard shortcuts

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