core

package
v0.0.0-...-62cfb4c Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INFOFILE_DB      = "db.json"
	INFOFILE_STORAGE = "storage.json"
	POSTFIX_ID       = "_id"
)

Variables

View Source
var MStates map[string]TState // ticket -> tState
View Source
var StLocalCoreSettings tCoreSettings = tCoreSettings{
	Storage:      "./data",
	BucketSize:   800,
	FriendlyMode: true,
}
View Source
var StStorageInfo tStorageInfo = tStorageInfo{}
View Source
var StWriteBuffer = gtypes.TCollectBuffers{
	Switch: 1,
}

Functions

func BinaryToUint64

func BinaryToUint64(slB []byte) uint64

func ChangeColumn

func ChangeColumn(sNameDB, sNameTable string, stNewDataColumn gtypes.TColumnForWrite, isSecure bool) bool

Changing a column

func CheckFolder

func CheckFolder(sPath, sName string) bool

Checking the folder name

func CreateColumn

func CreateColumn(sNameDB, sNameTable, sNameColumn string, isSecure bool, stSpecification gtypes.TColumnSpecification) bool

Creating a new column

func CreateDB

func CreateDB(sNameDB string, sOwner string, isSecure bool) bool

Creating a new database.

func CreateTable

func CreateTable(sNameDB, sNameTable string, isSecure bool) bool

Creating a new table.

func Decode64

func Decode64(sInput string) string

func DeleteRows

func DeleteRows(sNameDB, sNameTable string, stDeleteIn gtypes.TDeleteStruct) ([]uint64, bool)

func Encode64

func Encode64(sInput string) string

func GenerateName

func GenerateName() string

Name generation

func GenerateRev

func GenerateRev() string

Revision generation

func GetColumnById

func GetColumnById(sNameColumn string, uIdRow uint64, stAddData gtypes.TAdditionalData) (string, bool)

Get up-to-date cell data

func GetDBAccess

func GetDBAccess(sNameDB string) (gtypes.TAccess, bool)

func GetInfoById

func GetInfoById(uIdRow uint64, stAddData gtypes.TAdditionalData) (sTime string, sStatus string, sShape string, isOk bool)

func IfExistTable

func IfExistTable(sDB, sTable string) bool

func InsertIntoBuffer

func InsertIntoBuffer(stRowsForStore []gtypes.TRowForStore)

func InsertRows

func InsertRows(sNameDB, sNameTable string, slSColumns []string, slSlSRowsIn [][]string) ([]uint64, bool)

func LoadLocalCoreSettings

func LoadLocalCoreSettings(cfg *config.TConfig) tCoreSettings

func OrderByVQL

func OrderByVQL(uIds []uint64, stOrderByExp gtypes.TOrderBy, stAdditionalData gtypes.TAdditionalData) []uint64

func Pow

func Pow(uBase uint64, uExponent uint8) uint64

func RemoveColumn

func RemoveColumn(sNameDB, sNameTable, sNameColumn string) bool

Marks the column as deleted, but does not delete files.

func RemoveDB

func RemoveDB(sNameDB string) bool

Marks the database as deleted, but does not delete files.

func RemoveTable

func RemoveTable(sNameDB, sNameTable string) bool

Marks the table as deleted, but does not delete files.

func RenameDB

func RenameDB(sOldName, sNewName string, isSecure bool) bool

Rename a database.

func RenameTable

func RenameTable(sNameDB, sOldNameTable, sNewNameTable string, isSecure bool) bool

Rename a table.

func SelectRows

func SelectRows(sNameDB, sNameTable string, stSelectIn gtypes.TSelectStruct) ([]gtypes.TResponseRow, bool)

func SetAccessFlags

func SetAccessFlags(sDB, sUser string, stFlags gtypes.TAccessFlags)

func Shutdown

func Shutdown(ctx context.Context, c *closer.TCloser)

func Start

func Start(cfg *config.TConfig)

func StrongRemoveColumn

func StrongRemoveColumn(sNameDB, sNameTable, sNameColumn string) bool

Deletes the folder and column files, if column was mark as 'removed'

func StrongRemoveDB

func StrongRemoveDB(sNameDB string) bool

Deletes the folder and database files, if DB was mark as 'removed'

func StrongRemoveTable

func StrongRemoveTable(sNameDB, sNameTable string) bool

Deletes the folder and table files, if table was mark as 'removed'

func TruncateTable

func TruncateTable(sNameDB, sNameTable string) bool

func Uint64ToBinary

func Uint64ToBinary(u uint64) []byte

func UpdateRows

func UpdateRows(sNameDB, sNameTable string, stUpdateIn gtypes.TUpdaateStruct) ([]uint64, bool)

func WhereSelection

func WhereSelection(slStWhere []gtypes.TConditions, stAdditionalData gtypes.TAdditionalData) []uint64

func WriteBufferService

func WriteBufferService()

Types

type TColumnInfo

type TColumnInfo struct {
	Name          string                      `json:"name"`
	OldName       string                      `json:"oldname"` // only for core
	Folder        string                      `json:"folder"`
	Parents       string                      `json:"parents"`
	Specification gtypes.TColumnSpecification `json:"specification"`
	LastUpdate    time.Time                   `json:"lastupdate"`
	Deleted       bool                        `json:"deleted"`
}

type TDBInfo

type TDBInfo struct {
	Name       string                `json:"name"`
	Folder     string                `json:"folder"`
	Tables     map[string]TTableInfo `json:"tables"`
	Removed    []TTableInfo          `json:"removed"` // Removed tables
	LastUpdate time.Time             `json:"lastupdate"`
	Deleted    bool                  `json:"deleted"`
}

func GetDBInfo

func GetDBInfo(sNameDB string) (TDBInfo, bool)

func (TDBInfo) Save

func (d TDBInfo) Save() bool

Saving the database structure.

type TState

type TState struct {
	CurrentDB string
}

type TTableInfo

type TTableInfo struct {
	Name       string                 `json:"name"`
	Patronymic string                 `json:"patronymic"`
	Folder     string                 `json:"folder"`
	Parent     string                 `json:"parent"`
	Columns    map[string]TColumnInfo `json:"columns"`
	Removed    []TColumnInfo          `json:"removed"` // Removed columns
	Order      []string               `json:"order"`
	BucketLog  uint8                  `json:"blog"`
	BucketSize int64                  `json:"bsize"`
	OldRev     string                 `json:"oldrev"`
	CurrentRev string                 `json:"currentrev"`
	Count      uint64                 `json:"count"`
	LastUpdate time.Time              `json:"lastupdate"`
	Deleted    bool                   `json:"deleted"`
}

Jump to

Keyboard shortcuts

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