storage

package module
v0.0.0-...-4f17025 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TblName = &listTbls{
	Users:                0,
	Audit:                1,
	Xtokens:              2,
	Sessions:             3,
	Requests:             4,
	Userapps:             5,
	Legalbasis:           6,
	Agreements:           7,
	Sharedrecords:        8,
	Processingactivities: 9,
}

TblName is enum of tables

Functions

func CreateTestDB

func CreateTestDB() string

func DBExists

func DBExists(filepath *string) bool

func GetTable

func GetTable(t Tbl) string

Types

type BackendDB

type BackendDB interface {
	DBExists(*string) bool
	OpenDB(*string) error
	InitDB(*string) error
	CreateTestDB() string
	Ping() error
	CloseDB()
	BackupDB(http.ResponseWriter)
	CreateNewAppTable(string)
	Exec(string) error
	CreateRecordInTable(string, interface{}) (int, error)
	CreateRecord(Tbl, interface{}) (int, error)
	CountRecords0(Tbl) (int64, error)
	CountRecords(Tbl, string, string) (int64, error)
	UpdateRecord(Tbl, string, string, *bson.M) (int64, error)
	UpdateRecordInTable(string, string, string, *bson.M) (int64, error)
	UpdateRecord2(Tbl, string, string, string, string, *bson.M, *bson.M) (int64, error)
	UpdateRecordInTable2(string, string, string, string, string, *bson.M, *bson.M) (int64, error)
	LookupRecord(Tbl, bson.M) (bson.M, error)
	GetRecord(Tbl, string, string) (bson.M, error)
	GetRecordFromTable(string, string, string) (bson.M, error)
	GetRecord2(Tbl, string, string, string, string) (bson.M, error)
	DeleteRecord(Tbl, string, string) (int64, error)
	DeleteRecordInTable(string, string, string) (int64, error)
	DeleteRecord2(Tbl, string, string, string, string) (int64, error)
	DeleteExpired0(Tbl, int32) (int64, error)
	DeleteExpired(Tbl, string, string) (int64, error)
	CleanupRecord(Tbl, string, string, interface{}) (int64, error)
	GetExpiring(Tbl, string, string) ([]bson.M, error)
	GetUniqueList(Tbl, string) ([]bson.M, error)
	GetList0(Tbl, int32, int32, string) ([]bson.M, error)
	GetList(Tbl, string, string, int32, int32, string) ([]bson.M, error)
	GetAllTables() ([]string, error)
	ValidateNewApp(appName string) bool
}

func InitDB

func InitDB(dbname *string) (BackendDB, error)

InitDB function creates tables and indexes

func OpenDB

func OpenDB(dbname *string) (BackendDB, error)

type MySQLDB

type MySQLDB struct {
	// contains filtered or unexported fields
}

MySQL struct is used to store database object

func (MySQLDB) BackupDB

func (dbobj MySQLDB) BackupDB(w http.ResponseWriter)

BackupDB function backups existing database and prints database structure to http.ResponseWriter

func (MySQLDB) CleanupRecord

func (dbobj MySQLDB) CleanupRecord(t Tbl, keyName string, keyValue string, data interface{}) (int64, error)

CleanupRecord nullifies specific feilds in records in database

func (*MySQLDB) CloseDB

func (dbobj *MySQLDB) CloseDB()

CloseDB function closes the open database

func (MySQLDB) CountRecords

func (dbobj MySQLDB) CountRecords(t Tbl, keyName string, keyValue string) (int64, error)

CountRecords returns number of records that match filter

func (MySQLDB) CountRecords0

func (dbobj MySQLDB) CountRecords0(t Tbl) (int64, error)

CountRecords0 returns number of records in table

func (MySQLDB) CreateNewAppTable

func (dbobj MySQLDB) CreateNewAppTable(appName string)

CreateNewAppTable creates a new app table and creates indexes for it.

func (MySQLDB) CreateRecord

func (dbobj MySQLDB) CreateRecord(t Tbl, data interface{}) (int, error)

CreateRecord creates new record

func (MySQLDB) CreateRecordInTable

func (dbobj MySQLDB) CreateRecordInTable(tbl string, data interface{}) (int, error)

CreateRecordInTable creates new record

func (MySQLDB) CreateTestDB

func (dbobj MySQLDB) CreateTestDB() string

CreateTestDB creates a test db

func (MySQLDB) DBExists

func (dbobj MySQLDB) DBExists(dbname *string) bool

DBExists function checks if database exists

func (MySQLDB) DeleteExpired

func (dbobj MySQLDB) DeleteExpired(t Tbl, keyName string, keyValue string) (int64, error)

DeleteExpired deletes expired records in database

func (MySQLDB) DeleteExpired0

func (dbobj MySQLDB) DeleteExpired0(t Tbl, expt int32) (int64, error)

DeleteExpired0 deletes expired records in database

func (MySQLDB) DeleteRecord

func (dbobj MySQLDB) DeleteRecord(t Tbl, keyName string, keyValue string) (int64, error)

DeleteRecord deletes record in database

func (MySQLDB) DeleteRecord2

func (dbobj MySQLDB) DeleteRecord2(t Tbl, keyName string, keyValue string, keyName2 string, keyValue2 string) (int64, error)

DeleteRecord2 deletes record in database

func (MySQLDB) DeleteRecordInTable

func (dbobj MySQLDB) DeleteRecordInTable(table string, keyName string, keyValue string) (int64, error)

DeleteRecordInTable deletes record in database

func (MySQLDB) Exec

func (dbobj MySQLDB) Exec(q string) error

func (MySQLDB) GetAllTables

func (dbobj MySQLDB) GetAllTables() ([]string, error)

GetAllTables returns all tables that exists in database

func (MySQLDB) GetExpiring

func (dbobj MySQLDB) GetExpiring(t Tbl, keyName string, keyValue string) ([]bson.M, error)

GetExpiring get records that are expiring

func (MySQLDB) GetList

func (dbobj MySQLDB) GetList(t Tbl, keyName string, keyValue string, start int32, limit int32, orderField string) ([]bson.M, error)

GetList is used to return list of rows. It can be used to return values using pager.

func (MySQLDB) GetList0

func (dbobj MySQLDB) GetList0(t Tbl, start int32, limit int32, orderField string) ([]bson.M, error)

GetList is used to return list of rows. It can be used to return values using pager.

func (MySQLDB) GetRecord

func (dbobj MySQLDB) GetRecord(t Tbl, keyName string, keyValue string) (bson.M, error)

GetRecord returns specific record from database

func (MySQLDB) GetRecord2

func (dbobj MySQLDB) GetRecord2(t Tbl, keyName string, keyValue string,
	keyName2 string, keyValue2 string) (bson.M, error)

GetRecord2 returns specific record from database

func (MySQLDB) GetRecordFromTable

func (dbobj MySQLDB) GetRecordFromTable(table string, keyName string, keyValue string) (bson.M, error)

GetRecordFromTable returns specific record from database

func (MySQLDB) GetUniqueList

func (dbobj MySQLDB) GetUniqueList(t Tbl, keyName string) ([]bson.M, error)

GetUniqueList returns a unique list of values from specific column in database

func (*MySQLDB) InitDB

func (dbobj *MySQLDB) InitDB(dbname *string) error

InitDB function creates tables and indexes

func (MySQLDB) LookupRecord

func (dbobj MySQLDB) LookupRecord(t Tbl, row bson.M) (bson.M, error)

Lookup record by multiple fields

func (*MySQLDB) OpenDB

func (dbobj *MySQLDB) OpenDB(dbname *string) error

OpenDB function opens the database

func (MySQLDB) Ping

func (dbobj MySQLDB) Ping() error

func (MySQLDB) UpdateRecord

func (dbobj MySQLDB) UpdateRecord(t Tbl, keyName string, keyValue string, bdoc *bson.M) (int64, error)

UpdateRecord updates database record

func (MySQLDB) UpdateRecord2

func (dbobj MySQLDB) UpdateRecord2(t Tbl, keyName string, keyValue string,
	keyName2 string, keyValue2 string, bdoc *bson.M, bdel *bson.M) (int64, error)

UpdateRecord2 updates database record

func (MySQLDB) UpdateRecordInTable

func (dbobj MySQLDB) UpdateRecordInTable(table string, keyName string, keyValue string, bdoc *bson.M) (int64, error)

UpdateRecordInTable updates database record

func (MySQLDB) UpdateRecordInTable2

func (dbobj MySQLDB) UpdateRecordInTable2(table string, keyName string,
	keyValue string, keyName2 string, keyValue2 string, bdoc *bson.M, bdel *bson.M) (int64, error)

UpdateRecordInTable2 updates database record

func (MySQLDB) ValidateNewApp

func (dbobj MySQLDB) ValidateNewApp(appName string) bool

ValidateNewApp function check if app name can be part of the table name

type PGSQLDB

type PGSQLDB struct {
	// contains filtered or unexported fields
}

PGSQL struct is used to store database object

func (PGSQLDB) BackupDB

func (dbobj PGSQLDB) BackupDB(w http.ResponseWriter)

BackupDB function backups existing database and prints database structure to http.ResponseWriter

func (PGSQLDB) CleanupRecord

func (dbobj PGSQLDB) CleanupRecord(t Tbl, keyName string, keyValue string, data interface{}) (int64, error)

CleanupRecord nullifies specific feilds in records in database

func (*PGSQLDB) CloseDB

func (dbobj *PGSQLDB) CloseDB()

CloseDB function closes the open database

func (PGSQLDB) CountRecords

func (dbobj PGSQLDB) CountRecords(t Tbl, keyName string, keyValue string) (int64, error)

CountRecords returns number of records that match filter

func (PGSQLDB) CountRecords0

func (dbobj PGSQLDB) CountRecords0(t Tbl) (int64, error)

CountRecords0 returns number of records in table

func (PGSQLDB) CreateNewAppTable

func (dbobj PGSQLDB) CreateNewAppTable(appName string)

CreateNewAppTable creates a new app table and creates indexes for it.

func (PGSQLDB) CreateRecord

func (dbobj PGSQLDB) CreateRecord(t Tbl, data interface{}) (int, error)

CreateRecord creates new record

func (PGSQLDB) CreateRecordInTable

func (dbobj PGSQLDB) CreateRecordInTable(tbl string, data interface{}) (int, error)

CreateRecordInTable creates new record

func (PGSQLDB) CreateTestDB

func (dbobj PGSQLDB) CreateTestDB() string

CreateTestDB creates a test db

func (PGSQLDB) DBExists

func (dbobj PGSQLDB) DBExists(dbname *string) bool

DBExists function checks if database exists

func (PGSQLDB) DeleteExpired

func (dbobj PGSQLDB) DeleteExpired(t Tbl, keyName string, keyValue string) (int64, error)

DeleteExpired deletes expired records in database

func (PGSQLDB) DeleteExpired0

func (dbobj PGSQLDB) DeleteExpired0(t Tbl, expt int32) (int64, error)

DeleteExpired0 deletes expired records in database

func (PGSQLDB) DeleteRecord

func (dbobj PGSQLDB) DeleteRecord(t Tbl, keyName string, keyValue string) (int64, error)

DeleteRecord deletes record in database

func (PGSQLDB) DeleteRecord2

func (dbobj PGSQLDB) DeleteRecord2(t Tbl, keyName string, keyValue string, keyName2 string, keyValue2 string) (int64, error)

DeleteRecord2 deletes record in database

func (PGSQLDB) DeleteRecordInTable

func (dbobj PGSQLDB) DeleteRecordInTable(table string, keyName string, keyValue string) (int64, error)

DeleteRecordInTable deletes record in database

func (PGSQLDB) Exec

func (dbobj PGSQLDB) Exec(q string) error

func (PGSQLDB) GetAllTables

func (dbobj PGSQLDB) GetAllTables() ([]string, error)

GetAllTables returns all tables that exists in database

func (PGSQLDB) GetExpiring

func (dbobj PGSQLDB) GetExpiring(t Tbl, keyName string, keyValue string) ([]bson.M, error)

GetExpiring get records that are expiring

func (PGSQLDB) GetList

func (dbobj PGSQLDB) GetList(t Tbl, keyName string, keyValue string, start int32, limit int32, orderField string) ([]bson.M, error)

GetList is used to return list of rows. It can be used to return values using pager.

func (PGSQLDB) GetList0

func (dbobj PGSQLDB) GetList0(t Tbl, start int32, limit int32, orderField string) ([]bson.M, error)

GetList is used to return list of rows. It can be used to return values using pager.

func (PGSQLDB) GetRecord

func (dbobj PGSQLDB) GetRecord(t Tbl, keyName string, keyValue string) (bson.M, error)

GetRecord returns specific record from database

func (PGSQLDB) GetRecord2

func (dbobj PGSQLDB) GetRecord2(t Tbl, keyName string, keyValue string,
	keyName2 string, keyValue2 string) (bson.M, error)

GetRecord2 returns specific record from database

func (PGSQLDB) GetRecordFromTable

func (dbobj PGSQLDB) GetRecordFromTable(table string, keyName string, keyValue string) (bson.M, error)

GetRecordFromTable returns specific record from database

func (PGSQLDB) GetUniqueList

func (dbobj PGSQLDB) GetUniqueList(t Tbl, keyName string) ([]bson.M, error)

GetUniqueList returns a unique list of values from specific column in database

func (*PGSQLDB) InitDB

func (dbobj *PGSQLDB) InitDB(dbname *string) error

InitDB function creates tables and indexes

func (PGSQLDB) LookupRecord

func (dbobj PGSQLDB) LookupRecord(t Tbl, row bson.M) (bson.M, error)

Lookup record by multiple fields

func (*PGSQLDB) OpenDB

func (dbobj *PGSQLDB) OpenDB(dbname *string) error

OpenDB function opens the database

func (PGSQLDB) Ping

func (dbobj PGSQLDB) Ping() error

func (PGSQLDB) UpdateRecord

func (dbobj PGSQLDB) UpdateRecord(t Tbl, keyName string, keyValue string, bdoc *bson.M) (int64, error)

UpdateRecord updates database record

func (PGSQLDB) UpdateRecord2

func (dbobj PGSQLDB) UpdateRecord2(t Tbl, keyName string, keyValue string,
	keyName2 string, keyValue2 string, bdoc *bson.M, bdel *bson.M) (int64, error)

UpdateRecord2 updates database record

func (PGSQLDB) UpdateRecordInTable

func (dbobj PGSQLDB) UpdateRecordInTable(table string, keyName string, keyValue string, bdoc *bson.M) (int64, error)

UpdateRecordInTable updates database record

func (PGSQLDB) UpdateRecordInTable2

func (dbobj PGSQLDB) UpdateRecordInTable2(table string, keyName string,
	keyValue string, keyName2 string, keyValue2 string, bdoc *bson.M, bdel *bson.M) (int64, error)

UpdateRecordInTable2 updates database record

func (PGSQLDB) ValidateNewApp

func (dbobj PGSQLDB) ValidateNewApp(appName string) bool

ValidateNewApp function check if app name can be part of the table name

type SQLiteDB

type SQLiteDB struct {
	// contains filtered or unexported fields
}

SQLiteDB struct is used to store database object

func (SQLiteDB) BackupDB

func (dbobj SQLiteDB) BackupDB(w http.ResponseWriter)

BackupDB function backups existing database and prints database structure to http.ResponseWriter

func (SQLiteDB) CleanupRecord

func (dbobj SQLiteDB) CleanupRecord(t Tbl, keyName string, keyValue string, data interface{}) (int64, error)

CleanupRecord nullifies specific feilds in records in database

func (*SQLiteDB) CloseDB

func (dbobj *SQLiteDB) CloseDB()

CloseDB function closes the open database

func (SQLiteDB) CountRecords

func (dbobj SQLiteDB) CountRecords(t Tbl, keyName string, keyValue string) (int64, error)

CountRecords returns number of records that match filter

func (SQLiteDB) CountRecords0

func (dbobj SQLiteDB) CountRecords0(t Tbl) (int64, error)

CountRecords returns number of records in table

func (SQLiteDB) CreateNewAppTable

func (dbobj SQLiteDB) CreateNewAppTable(appName string)

CreateNewAppTable creates a new app table and creates indexes for it.

func (SQLiteDB) CreateRecord

func (dbobj SQLiteDB) CreateRecord(t Tbl, data interface{}) (int, error)

CreateRecord creates new record

func (SQLiteDB) CreateRecordInTable

func (dbobj SQLiteDB) CreateRecordInTable(tbl string, data interface{}) (int, error)

CreateRecordInTable creates new record

func (SQLiteDB) CreateTestDB

func (dbobj SQLiteDB) CreateTestDB() string

CreateTestDB creates a test db

func (SQLiteDB) DBExists

func (dbobj SQLiteDB) DBExists(filepath *string) bool

DBExists function checks if database exists

func (SQLiteDB) DeleteExpired

func (dbobj SQLiteDB) DeleteExpired(t Tbl, keyName string, keyValue string) (int64, error)

DeleteExpired deletes expired records in database

func (SQLiteDB) DeleteExpired0

func (dbobj SQLiteDB) DeleteExpired0(t Tbl, expt int32) (int64, error)

DeleteExpired0 deletes expired records in database

func (SQLiteDB) DeleteRecord

func (dbobj SQLiteDB) DeleteRecord(t Tbl, keyName string, keyValue string) (int64, error)

DeleteRecord deletes record in database

func (SQLiteDB) DeleteRecord2

func (dbobj SQLiteDB) DeleteRecord2(t Tbl, keyName string, keyValue string, keyName2 string, keyValue2 string) (int64, error)

DeleteRecord2 deletes record in database

func (SQLiteDB) DeleteRecordInTable

func (dbobj SQLiteDB) DeleteRecordInTable(table string, keyName string, keyValue string) (int64, error)

DeleteRecordInTable deletes record in database

func (SQLiteDB) Exec

func (dbobj SQLiteDB) Exec(q string) error

func (SQLiteDB) GetAllTables

func (dbobj SQLiteDB) GetAllTables() ([]string, error)

GetAllTables returns all tables that exists in database

func (SQLiteDB) GetExpiring

func (dbobj SQLiteDB) GetExpiring(t Tbl, keyName string, keyValue string) ([]bson.M, error)

GetExpiring get records that are expiring

func (SQLiteDB) GetList

func (dbobj SQLiteDB) GetList(t Tbl, keyName string, keyValue string, start int32, limit int32, orderField string) ([]bson.M, error)

GetList is used to return list of rows. It can be used to return values using pager.

func (SQLiteDB) GetList0

func (dbobj SQLiteDB) GetList0(t Tbl, start int32, limit int32, orderField string) ([]bson.M, error)

GetList is used to return list of rows. It can be used to return values using pager.

func (SQLiteDB) GetRecord

func (dbobj SQLiteDB) GetRecord(t Tbl, keyName string, keyValue string) (bson.M, error)

GetRecord returns specific record from database

func (SQLiteDB) GetRecord2

func (dbobj SQLiteDB) GetRecord2(t Tbl, keyName string, keyValue string,
	keyName2 string, keyValue2 string) (bson.M, error)

GetRecord2 returns specific record from database

func (SQLiteDB) GetRecordFromTable

func (dbobj SQLiteDB) GetRecordFromTable(table string, keyName string, keyValue string) (bson.M, error)

GetRecordFromTable returns specific record from database

func (SQLiteDB) GetUniqueList

func (dbobj SQLiteDB) GetUniqueList(t Tbl, keyName string) ([]bson.M, error)

GetUniqueList returns a unique list of values from specific column in database

func (*SQLiteDB) InitDB

func (dbobj *SQLiteDB) InitDB(filepath *string) error

InitDB function creates tables and indexes

func (SQLiteDB) LookupRecord

func (dbobj SQLiteDB) LookupRecord(t Tbl, row bson.M) (bson.M, error)

Lookup record by multiple fields

func (*SQLiteDB) OpenDB

func (dbobj *SQLiteDB) OpenDB(filepath *string) error

OpenDB function opens the database

func (SQLiteDB) Ping

func (dbobj SQLiteDB) Ping() error

func (SQLiteDB) UpdateRecord

func (dbobj SQLiteDB) UpdateRecord(t Tbl, keyName string, keyValue string, bdoc *bson.M) (int64, error)

UpdateRecord updates database record

func (SQLiteDB) UpdateRecord2

func (dbobj SQLiteDB) UpdateRecord2(t Tbl, keyName string, keyValue string,
	keyName2 string, keyValue2 string, bdoc *bson.M, bdel *bson.M) (int64, error)

UpdateRecord2 updates database record

func (SQLiteDB) UpdateRecordInTable

func (dbobj SQLiteDB) UpdateRecordInTable(table string, keyName string, keyValue string, bdoc *bson.M) (int64, error)

UpdateRecordInTable updates database record

func (SQLiteDB) UpdateRecordInTable2

func (dbobj SQLiteDB) UpdateRecordInTable2(table string, keyName string,
	keyValue string, keyName2 string, keyValue2 string, bdoc *bson.M, bdel *bson.M) (int64, error)

UpdateRecordInTable2 updates database record

func (SQLiteDB) ValidateNewApp

func (dbobj SQLiteDB) ValidateNewApp(appName string) bool

ValidateNewApp function check if app name can be part of the table name

type Tbl

type Tbl int

Tbl is used to store table id

Jump to

Keyboard shortcuts

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