dbase

package
v0.0.0-...-d47f070 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BOOL = 4
View Source
var EMBED = 5
View Source
var FLOAT = 3
View Source
var INTEGER = 2
View Source
var Logging bool
View Source
var NULL = 6
View Source
var STRING = 1

Type codes

Functions

func ListToInterfaceList

func ListToInterfaceList(value interface{}) (result []interface{}, err error)

func TypesToValue

func TypesToValue(typeCode int, vStr string, vInt int64, vFloat float64, vBool bool, vEmbed string) (value interface{}, err error)

func ValueToTypes

func ValueToTypes(value interface{}) (typeCode int, vStr string, vInt int64, vFloat float64, vBool bool, vEmbed string, err error)

Converts a value from an object into a type code and the set of variables needed by the datebase

Types

type HathiDB

type HathiDB struct {
	DB *sql.DB
}

The Go DB is wrapped so that other code is as isolated as possible from the details of what database type is being dealt with. There may be other data to track in future so we save on transition costs if that happens. The cost is that we have to implement methods like Close()

func OpenDatabase

func OpenDatabase(dbtype string, filename string) (db *HathiDB, err error)

func (*HathiDB) BeginTransaction

func (h *HathiDB) BeginTransaction() (tx *sql.Tx, err error)

func (*HathiDB) CheckPrivilege

func (h *HathiDB) CheckPrivilege(tx *sql.Tx, objID string, actorID string, bitname string) (set bool, err error)

func (*HathiDB) Close

func (h *HathiDB) Close() (err error)

func (*HathiDB) DeleteObjectData

func (h *HathiDB) DeleteObjectData(tx *sql.Tx, objID string) (err error)

func (*HathiDB) EndTransaction

func (h *HathiDB) EndTransaction(tx *sql.Tx, errIn *error) (err error)

func (*HathiDB) GenerateIDCode

func (h *HathiDB) GenerateIDCode(tx *sql.Tx, idName string) (id string, err error)

func (*HathiDB) GetAllObjectIDs

func (h *HathiDB) GetAllObjectIDs(tx *sql.Tx) (ids []string, err error)

func (*HathiDB) GetAllPrivilegeIDs

func (h *HathiDB) GetAllPrivilegeIDs(tx *sql.Tx) (ids []string, err error)

func (*HathiDB) GetObjActPrivileges

func (h *HathiDB) GetObjActPrivileges(tx *sql.Tx, objID string, actorID string) (privs []string, err error)

func (*HathiDB) GetObjectPrivileges

func (h *HathiDB) GetObjectPrivileges(tx *sql.Tx, objID string) (owners map[string][]string, err error)

func (*HathiDB) Initialize

func (h *HathiDB) Initialize() (err error)

func (*HathiDB) ListAddI

func (h *HathiDB) ListAddI(tx *sql.Tx, objID string, fieldName string, index int, value interface{}) (err error)

func (*HathiDB) ListAppend

func (h *HathiDB) ListAppend(tx *sql.Tx, objID string, fieldName string, value interface{}) (err error)

func (*HathiDB) ListGetI

func (h *HathiDB) ListGetI(tx *sql.Tx, objID string, fieldName string, index int) (value interface{}, err error)

func (*HathiDB) ListGetRange

func (h *HathiDB) ListGetRange(tx *sql.Tx, objID string, fieldName string, start int, length int) (values []interface{}, err error)

func (*HathiDB) ListMaxIndex

func (h *HathiDB) ListMaxIndex(tx *sql.Tx, objID string, fieldName string) (index int, err error)

func (*HathiDB) ListRM

func (h *HathiDB) ListRM(tx *sql.Tx, objID string, fieldName string, index int) (err error)

func (*HathiDB) ListSetI

func (h *HathiDB) ListSetI(tx *sql.Tx, objID string, fieldName string, index int, value interface{}) (err error)

func (*HathiDB) LoadFieldItems

func (h *HathiDB) LoadFieldItems(tx *sql.Tx, objID string, field string) (value []interface{}, err error)

func (*HathiDB) LoadObject

func (h *HathiDB) LoadObject(tx *sql.Tx, objID string) (obj *activitypub.Object, err error)

func (*HathiDB) LoadObjectData

func (h *HathiDB) LoadObjectData(tx *sql.Tx, objID string) (objData map[string]interface{}, err error)

func (*HathiDB) SetObjActPrivileges

func (h *HathiDB) SetObjActPrivileges(tx *sql.Tx, objID string, actorID string, privs []string) (err error)

func (*HathiDB) SetObjectPrivileges

func (h *HathiDB) SetObjectPrivileges(tx *sql.Tx, objID string, actors map[string][]string) (err error)

func (*HathiDB) SetPrivilege

func (h *HathiDB) SetPrivilege(tx *sql.Tx, objID string, actorID string, bitname string, value bool) (err error)

func (*HathiDB) StoreField

func (h *HathiDB) StoreField(tx *sql.Tx, objID string, name string, value interface{}) (err error)

func (*HathiDB) StoreFieldItem

func (h *HathiDB) StoreFieldItem(tx *sql.Tx, objID string, name string, index int, item interface{}) (err error)

func (*HathiDB) StoreObject

func (h *HathiDB) StoreObject(tx *sql.Tx, obj *activitypub.Object) (err error)

func (*HathiDB) StoreObjectData

func (h *HathiDB) StoreObjectData(tx *sql.Tx, objID string, objData map[string]interface{}) (err error)

Jump to

Keyboard shortcuts

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