codium_lib

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: MIT Imports: 11 Imported by: 2

README

codium_lib

This library is for communication between the database and external programs

Documentation

Overview

Package codium_lib provides a golang interface to the codium database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProject

func CreateProject(address, keyStr, projName string) error

A Project is a container of tables

func DeleteProject

func DeleteProject(address, keyStr, projName string) error

Types

type Client

type Client struct {
	Addr        string
	KeyStr      string
	ProjectName string
}

func NewClient

func NewClient(addr, keyStr, projectName string) Client

func (Client) CountRows

func (cl Client) CountRows(stmt string) (int64, error)

func (*Client) CreateTable

func (cl *Client) CreateTable(stmt string) error

func (Client) DeleteFields

func (cl Client) DeleteFields(stmt string, toDeleteFields []string) error

func (Client) DeleteRows

func (cl Client) DeleteRows(stmt string) error

func (*Client) DeleteTable added in v1.1.4

func (cl *Client) DeleteTable(tableName string) error

func (*Client) EmptyTable

func (cl *Client) EmptyTable(tableName string) error

func (*Client) GetCurrentTableDefn

func (cl *Client) GetCurrentTableDefn(tableName string) (string, error)

func (*Client) GetCurrentTableDefnParsed added in v1.1.0

func (cl *Client) GetCurrentTableDefnParsed(tableName string) (codium_shared.TableDefn, error)

func (*Client) GetTableDefn added in v1.1.3

func (cl *Client) GetTableDefn(tableName, version string) (string, error)

func (*Client) GetTableDefnParsed added in v1.1.3

func (cl *Client) GetTableDefnParsed(tableName, version string) (codium_shared.TableDefn, error)

func (*Client) InsertIntoTable

func (cl *Client) InsertIntoTable(tableName string, toInsert map[string]interface{}) (int64, error)

func (Client) ListProjects

func (cl Client) ListProjects() ([]string, error)

func (Client) ListTables

func (cl Client) ListTables() ([]string, error)

func (*Client) ParseRow added in v1.1.1

func (cl *Client) ParseRow(rowStr map[string]string, td codium_shared.TableDefn) (map[string]interface{}, error)

ParseRow given a TableDefn would convert a map of strings to a map of interfaces.

func (*Client) Ping

func (cl *Client) Ping() error

Ping checks if the details supplied at the creation of a Client is valid. it returns an error if invalid and nil if not.

func (*Client) RenameProject added in v1.1.0

func (cl *Client) RenameProject(projName, newProjName string) error

func (*Client) RenameTable added in v1.1.0

func (cl *Client) RenameTable(tableName, newTableName string) error

func (*Client) Search

func (cl *Client) Search(stmt string) (*[]map[string]interface{}, error)

func (Client) SearchForOne

func (cl Client) SearchForOne(stmt string) (*map[string]interface{}, error)

func (Client) SumRows

func (cl Client) SumRows(stmt, toSumField string) (interface{}, error)

Sums the fields of a row and returns int64 if it is an int field or float64 if it a float field.

func (Client) UpdateRows

func (cl Client) UpdateRows(stmt string, updateData map[string]interface{}) error

func (*Client) UpdateTableDefn

func (cl *Client) UpdateTableDefn(stmt string) error

If you wanted to only rename the table, use RenameTable instead.

Jump to

Keyboard shortcuts

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