memdb

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Int     string = "INT"
	Int64   string = "INT64"
	Float32 string = "FLOAT32"
	Float64 string = "FLOAT64"
	Bool    string = "BOOL"
	String  string = "STRING"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Col

type Col struct {
	Name       string
	Type       string
	IntVal     int
	Int64Val   int64
	Float32Val float32
	Float64Val float64
	BoolVal    bool
	StringVal  string
}

type Database

type Database struct {
	Name   string
	Tables map[string]*Table
}

func CreateDatabase

func CreateDatabase(name string) Database

func (*Database) Create

func (db *Database) Create(tableName string, cols ...Col) error

type Result

type Result struct {
	TableName string
	Db        *Database
	RowCount  int
	Rows      []Row
	Error     error
}

func (*Result) And

func (r *Result) And(col string, op string, operand interface{}) *Result

func (*Result) Delete

func (r *Result) Delete()

func (*Result) Or

func (r *Result) Or(col string, op string, operand interface{}) *Result

func (*Result) Select

func (r *Result) Select(cols string) *Result

func (*Result) Update

func (r *Result) Update(col string, value interface{})

type Row

type Row struct {
	Id      int
	Columns map[string]Col
}

type Table

type Table struct {
	sync.Mutex
	Name     string
	Columns  map[string]Col
	Rows     map[int]Row
	RowCount int
	Db       *Database
}

func (*Table) Insert

func (table *Table) Insert(cols string, values ...interface{}) error

func (*Table) Select

func (table *Table) Select(cols string) Result

func (*Table) Where

func (table *Table) Where(col string, op string, operand interface{}) *Result

Jump to

Keyboard shortcuts

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