flaarum_shared

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 12 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 = `` /* 858-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 GetDataPath

func GetDataPath() (string, error)

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

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 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 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