flaarum_shared

package
v1.7.11 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 14 Imported by: 0

README

flaarum_shared

flaarum_shared is a package of functions shared by the executables of this project.

Some of these functions is expected to run on the same machine as a flaarum server.

Documentation

Overview

This package contains functions shared by the programs of this project. Some of these functions is expected to run on the same machine as a flaarum server.

Index

Constants

View Source
const (
	DATE_FORMAT       = "2006-01-02"
	DATETIME_FORMAT   = "2006-01-02T15:04 MST"
	STRING_MAX_LENGTH = 100
	TEXT_INTR_DELIM   = "~~~"
	BACKUP_EXT        = "flaa1"
	PORT              = 22318
)

Variables

View Source
var ALLOWED_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789"
View Source
var RootConfigTemplate = `` /* 365-byte string literal not displayed */

Functions

func CleanWord added in v1.3.0

func CleanWord(word string) string

func DoesPathExists added in v1.3.0

func DoesPathExists(p string) bool

func DoesTableExists

func DoesTableExists(projName, tableName string) bool

func FindIn

func FindIn(container []string, elem string) int

func G added in v1.3.0

func G(objectName string) string

func GetConfigPath

func GetConfigPath() (string, error)

func GetCtlConfigPath added in v1.5.5

func GetCtlConfigPath() (string, error)

func GetCurrentVersionNum added in v1.7.5

func GetCurrentVersionNum(projName, tableName string) (int, error)

func GetDataPath

func GetDataPath() (string, error)

func GetFieldType added in v1.7.5

func GetFieldType(projName, tableName, fieldName string) string

func GetFlaarumPath added in v1.4.1

func GetFlaarumPath(fileName string) (string, error)

func GetKeyStrPath

func GetKeyStrPath() string

func GetSetting

func GetSetting(settingName string) string

func IsNotIndexedFieldVersioned added in v1.7.0

func IsNotIndexedFieldVersioned(projName, tableName, fieldName, version string) bool

func MakeIndex

func MakeIndex(projName, tableName, fieldName, newData, rowId string) error

func MakeSafeIndexName

func MakeSafeIndexName(v string) string

func NameValidate added in v1.3.0

func NameValidate(name string) error

func UntestedRandomString

func UntestedRandomString(length int) string

func WriteIntIndexesToFile added in v1.7.5

func WriteIntIndexesToFile(in []IntIndexes, intIndexesFile string) error

func WriteTimeIndexesToFile added in v1.7.5

func WriteTimeIndexesToFile(in []TimeIndexes, timeIndexesFile, dataType string) error

Types

type FKeyStruct

type FKeyStruct struct {
	FieldName    string
	PointedTable string
	OnDelete     string // expects one of "on_delete_restrict", "on_delete_empty", "on_delete_delete"
}

type FTSStmtStruct added in v1.3.0

type FTSStmtStruct struct {
	Optional   []string
	Compulsory []string
	Excluded   []string
}

Full text search statement

func ParseFTSStmt added in v1.3.0

func ParseFTSStmt(stmt string) FTSStmtStruct

type FieldStruct

type FieldStruct struct {
	FieldName  string
	FieldType  string
	Required   bool
	Unique     bool
	NotIndexed bool
}

type IntIndexes added in v1.7.5

type IntIndexes struct {
	IntIndex int64
	Ids      []int64
}

func AppendToIntIndexes added in v1.7.5

func AppendToIntIndexes(container []IntIndexes, intKey, rowId int64) []IntIndexes

func ReadIntIndexesFromFile added in v1.7.5

func ReadIntIndexesFromFile(intIndexesFile string) ([]IntIndexes, error)

func RemoveFromIntIndexes added in v1.7.5

func RemoveFromIntIndexes(container []IntIndexes, intKey, rowId int64) []IntIndexes

type StmtStruct

type StmtStruct struct {
	TableName      string
	Fields         []string
	Expand         bool
	Distinct       bool
	StartIndex     int64
	Limit          int64
	OrderBy        string
	OrderDirection string // one of 'asc' or 'desc'
	WhereOptions   []WhereStruct
}

func ParseSearchStmt

func ParseSearchStmt(stmt string) (StmtStruct, error)

type TableStruct

type TableStruct struct {
	TableName    string
	TableType    string // one or "proper" or "logs"
	Fields       []FieldStruct
	ForeignKeys  []FKeyStruct
	UniqueGroups [][]string
}

func GetTableStructureParsed added in v1.4.2

func GetTableStructureParsed(projName, tableName string, versionNum int) (TableStruct, error)

func ParseTableStructureStmt

func ParseTableStructureStmt(stmt string) (TableStruct, error)

type TimeIndexes added in v1.7.5

type TimeIndexes struct {
	GoTimeValue time.Time
	Ids         []int64
}

func AppendToTimeIndexes added in v1.7.5

func AppendToTimeIndexes(container []TimeIndexes, newTimeValue time.Time, rowId int64) []TimeIndexes

func ReadTimeIndexesFromFile added in v1.7.5

func ReadTimeIndexesFromFile(timeIndexesFile string, dataType string) ([]TimeIndexes, error)

func RemoveFromTimeIndexes added in v1.7.5

func RemoveFromTimeIndexes(container []TimeIndexes, newTimeValue time.Time, rowId int64) []TimeIndexes

type WhereStruct

type WhereStruct struct {
	FieldName   string
	Relation    string // eg. '=', '!=', '<', etc.
	FieldValue  string
	Joiner      string   // one of 'and', 'or', 'orf'
	FieldValues []string // for 'in' and 'nin' queries
}

Jump to

Keyboard shortcuts

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