db

package
v0.0.0-...-41e8ecb Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: GPL-3.0 Imports: 21 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SESSION_EXPIRE = 10000 //>2 <6 hours
)

Variables

View Source
var Assets embed.FS

Functions

func FieldType

func FieldType(name string) string

Types

type TypeCommand

type TypeCommand struct {
	Name   string
	Label  string
	Linker bool
}

type TypeField

type TypeField struct {
	Type        string
	Name        string
	Label       string
	Value       string
	SearchIndex int64
	SearchSize  int64
	ListIndex   int64
	ListSize    int64
	EditIndex   int64
	EditSize    int64
	Options     []TypeSelect
}

type TypeGroup

type TypeGroup struct {
	Name        string              `json:"name"`
	Type        string              `json:"type"`
	Shares      []string            `json:"shares,omitempty"`
	Permissions map[string][]string `json:"permissions,omitempty"`
}
type TypeLink struct {
	Label       string `json:"Label,omitempty"`
	ModuleId    int64  `json:"ModuleId,omitempty"`
	ModuleLabel string `json:"ModuleLabel,omitempty"`
	FieldId     int64  `json:"FieldId,omitempty"`
}

type TypeModule

type TypeModule struct {
	Module      TypeModuleModule        `json:"module"`
	Command     []string                `json:"command"`
	Field       []TypeModuleField       `json:"field"`
	Link        []TypeModuleLink        `json:"link,omitempty"`
	Translation []TypeModuleTranslation `json:"translation,omitempty"`
	Name        string                  `json:"name"`
	Data        []map[string]any        `json:"data,omitempty"`
	Type        string                  `json:"type"`
}

type TypeModuleField

type TypeModuleField struct {
	Value       string `json:"value"`
	PowerEdit   int64  `json:"powerEdit"`
	PowerList   int64  `json:"powerList"`
	Type        string `json:"type"`
	Translate   int64  `json:"translate"`
	PowerSearch int64  `json:"powerSearch"`
	Name        string `json:"name"`
	SizeSearch  int64  `json:"sizeSearch"`
	SizeList    int64  `json:"sizeList"`
	SizeEdit    int64  `json:"sizeEdit"`
}
type TypeModuleLink struct {
	SrcField  string `json:"srcField,omitempty"`
	SrcModule string `json:"srcModule"`
	DstModule string `json:"dstModule"`
	Power     int64  `json:"power,omitempty"`
}

type TypeModuleModule

type TypeModuleModule struct {
	ParentName  string `json:"parentName,omitempty"`
	Power       int64  `json:"power"`
	SearchLimit int64  `json:"searchLimit"`
	SqlCreated  int64  `json:"sqlCreated"`
	SortList    string `json:"sortList,omitempty"`
}

type TypeModulePath

type TypeModulePath struct {
	Id    int64
	Name  string
	Label string
}

type TypeModuleTranslation

type TypeModuleTranslation struct {
	EjaLanguage   string `json:"ejaLanguage"`
	EjaModuleName string `json:"ejaModuleName,omitempty"`
	Word          string `json:"word"`
	Translation   string `json:"translation"`
}

type TypeModuleTree

type TypeModuleTree struct {
	Id    int64
	Name  string
	Label string
}

type TypeRow

type TypeRow map[string]string

type TypeRows

type TypeRows []map[string]string

type TypeRun

type TypeRun struct {
	Changes int64
	LastId  int64
}

type TypeSearchColumn

type TypeSearchColumn map[string]map[string]any

type TypeSelect

type TypeSelect struct {
	Key   string
	Value string
}

type TypeSession

type TypeSession struct {
	Handler      *sql.DB
	Engine       string
	ConnectionId int64
}

func Session

func Session() TypeSession

func (*TypeSession) AutoSearch

func (session *TypeSession) AutoSearch(moduleId int64) (check bool)

func (*TypeSession) Bool

func (session *TypeSession) Bool(value any) bool

func (*TypeSession) Close

func (session *TypeSession) Close() error

func (*TypeSession) Cols

func (session *TypeSession) Cols(query string, args ...any) ([]string, error)

func (*TypeSession) CommandExists

func (session *TypeSession) CommandExists(commands []TypeCommand, commandName string) bool

func (*TypeSession) Commands

func (session *TypeSession) Commands(userId int64, moduleId int64, actionType string) ([]TypeCommand, error)

func (*TypeSession) Del

func (session *TypeSession) Del(ownerId int64, moduleId, ejaId int64) error

func (*TypeSession) FieldAdd

func (session *TypeSession) FieldAdd(tableName string, fieldName string, fieldType string) error

func (*TypeSession) FieldExists

func (session *TypeSession) FieldExists(tableName string, fieldName string) (bool, error)

func (*TypeSession) FieldNameIsValid

func (session *TypeSession) FieldNameIsValid(name string) error

func (*TypeSession) FieldNameList

func (session *TypeSession) FieldNameList(moduleId int64, actionType string) (fields []string)

func (*TypeSession) FieldTypeGet

func (session *TypeSession) FieldTypeGet(moduleId int64, fieldName string) string

func (*TypeSession) Fields

func (session *TypeSession) Fields(ownerId int64, moduleId int64, actionType string, values map[string]string) ([]TypeField, error)

func (*TypeSession) Float

func (session *TypeSession) Float(nameValue any) float64

func (*TypeSession) Get

func (session *TypeSession) Get(ownerId int64, moduleId int64, ejaId int64) (TypeRow, error)

func (*TypeSession) GroupExport

func (session *TypeSession) GroupExport(groupId int64) (group TypeGroup, err error)

func (*TypeSession) GroupImport

func (session *TypeSession) GroupImport(group TypeGroup, groupName string) (err error)

func (*TypeSession) IncludeList

func (session *TypeSession) IncludeList(query string, args ...any) ([]int64, error)

func (*TypeSession) IsSubModule

func (session *TypeSession) IsSubModule(moduleId int64) bool

func (*TypeSession) LinkAdd

func (session *TypeSession) LinkAdd(ownerId int64, moduleId int64, fieldId int64, linkModuleId int64, linkFieldId int64) error

func (*TypeSession) LinkCopy

func (session *TypeSession) LinkCopy(userId int64, dstFieldNew int64, dstModule int64, dstFieldOriginal int64) (TypeRun, error)

func (*TypeSession) LinkDel

func (session *TypeSession) LinkDel(ownerId int64, moduleId int64, fieldId int64, linkModuleId int64, linkFieldId int64) error

func (*TypeSession) ModuleAppend

func (session *TypeSession) ModuleAppend(module TypeModule, moduleName string) error

func (*TypeSession) ModuleExport

func (session *TypeSession) ModuleExport(moduleId int64, data bool) (module TypeModule, err error)

func (*TypeSession) ModuleGetIdByName

func (session *TypeSession) ModuleGetIdByName(name string) int64

func (*TypeSession) ModuleGetNameById

func (session *TypeSession) ModuleGetNameById(id int64) string

func (*TypeSession) ModuleImport

func (session *TypeSession) ModuleImport(module TypeModule, moduleName string) error
func (session *TypeSession) ModuleLinks(ownerId int64, moduleId int64) (result []TypeLink)

func (*TypeSession) ModuleLinksFieldName

func (session *TypeSession) ModuleLinksFieldName(moduleId, linkModuleId int64) string

func (*TypeSession) ModulePath

func (session *TypeSession) ModulePath(ownerId int64, moduleId int64) (result []TypeModulePath)

func (*TypeSession) ModuleTree

func (session *TypeSession) ModuleTree(ownerId int64, moduleId int64, modulePath []TypeModulePath) (result []TypeModuleTree)

func (*TypeSession) New

func (session *TypeSession) New(ownerId int64, moduleId int64) (int64, error)

func (TypeSession) Now

func (session TypeSession) Now() string

func (*TypeSession) Number

func (session *TypeSession) Number(nameValue any) int64

func (*TypeSession) NumbersToCsv

func (session *TypeSession) NumbersToCsv(slice []int64) string

func (*TypeSession) Open

func (session *TypeSession) Open(engine string, database string, username string, password string, host string, port int) (err error)

func (*TypeSession) Owners

func (session *TypeSession) Owners(ownerId int64, moduleId int64) (result []int64)

func (*TypeSession) OwnersCsv

func (session *TypeSession) OwnersCsv(ownerId int64, moduleId int64) string

func (*TypeSession) Password

func (session *TypeSession) Password(value string) string

func (*TypeSession) PermissionAdd

func (session *TypeSession) PermissionAdd(userId int64, moduleId int64, commandName string) int64

func (*TypeSession) PermissionAddDefault

func (session *TypeSession) PermissionAddDefault(userId int64, moduleId int64) int64

func (*TypeSession) PermissionCount

func (session *TypeSession) PermissionCount(moduleId int64) int64

func (*TypeSession) Put

func (session *TypeSession) Put(ownerId int64, moduleId int64, ejaId int64, fieldName string, fieldValue any) error

func (*TypeSession) Row

func (session *TypeSession) Row(query string, args ...any) (result TypeRow, err error)

func (*TypeSession) Rows

func (session *TypeSession) Rows(query string, args ...any) (result TypeRows, err error)

func (*TypeSession) Run

func (session *TypeSession) Run(query string, args ...any) (result TypeRun, err error)

func (*TypeSession) SearchCount

func (session *TypeSession) SearchCount(query string, args []any) int64
func (session *TypeSession) SearchLinks(ownerId int64, srcModuleId int64, srcFieldId int64, dstModuleId int64) []string

func (*TypeSession) SearchMatrix

func (session *TypeSession) SearchMatrix(ownerId int64, moduleId int64, query string, queryArgs []any) (resultRows TypeRows, resultCols []string, resultLabels map[string]string, err error)

func (*TypeSession) SearchQuery

func (session *TypeSession) SearchQuery(ownerId int64, tableName string, values map[string]string) (string, []any, error)
func (session *TypeSession) SearchQueryLinks(ownerId, srcModuleId, srcFieldId, dstModuleId int64) string

func (*TypeSession) SearchQueryOrderAndLimit

func (session *TypeSession) SearchQueryOrderAndLimit(order string, limit int64, offset int64) string

func (*TypeSession) SelectSqlToRows

func (session *TypeSession) SelectSqlToRows(query string) []TypeSelect

func (*TypeSession) SelectToRows

func (session *TypeSession) SelectToRows(value string) []TypeSelect
func (session *TypeSession) SessionCleanLink(userId int64) error

func (*TypeSession) SessionCleanSearch

func (session *TypeSession) SessionCleanSearch(userId int64) error

func (*TypeSession) SessionInit

func (session *TypeSession) SessionInit(userId int64) string

func (*TypeSession) SessionLoad

func (session *TypeSession) SessionLoad(userId int64, moduleId int64) (TypeRows, error)

func (*TypeSession) SessionPut

func (session *TypeSession) SessionPut(userId int64, name string, value string, subName ...string) (err error)

func (*TypeSession) SessionReset

func (session *TypeSession) SessionReset(userId int64) error

func (*TypeSession) SessionTokenUpdate

func (session *TypeSession) SessionTokenUpdate(userId int64, sessionHash string) string

func (*TypeSession) Setup

func (session *TypeSession) Setup(setupPath string) error

func (*TypeSession) SetupAdmin

func (session *TypeSession) SetupAdmin(setupUser string, setupPass string) error

func (*TypeSession) Sha256

func (session *TypeSession) Sha256(value string) string

func (*TypeSession) String

func (session *TypeSession) String(nameValue any) string

func (*TypeSession) SubModules

func (session *TypeSession) SubModules(ownerId int64, moduleId int64) (result []TypeLink)

func (*TypeSession) TableAdd

func (session *TypeSession) TableAdd(name string, tmp ...bool) error

func (*TypeSession) TableDel

func (session *TypeSession) TableDel(name string) error

func (*TypeSession) TableExists

func (session *TypeSession) TableExists(name string) (bool, error)

func (*TypeSession) TableGetAllById

func (session *TypeSession) TableGetAllById(tableName string, ejaId int64) TypeRow

func (*TypeSession) TableNameIsValid

func (session *TypeSession) TableNameIsValid(name string) error

func (*TypeSession) Translate

func (session *TypeSession) Translate(value string, user ...int64) string

func (*TypeSession) UserGetAllById

func (session *TypeSession) UserGetAllById(userId int64) TypeRow

func (*TypeSession) UserGetAllBySession

func (session *TypeSession) UserGetAllBySession(sessionHash string) TypeRow

func (*TypeSession) UserGetAllByUserAndPass

func (session *TypeSession) UserGetAllByUserAndPass(username string, password string) TypeRow

func (*TypeSession) UserGetAllByUsername

func (session *TypeSession) UserGetAllByUsername(username string) TypeRow

func (*TypeSession) UserGroupCsv

func (session *TypeSession) UserGroupCsv(userId int64) string

func (*TypeSession) UserGroupList

func (session *TypeSession) UserGroupList(userId int64) []int64

func (*TypeSession) UserPermissionCopy

func (session *TypeSession) UserPermissionCopy(userId int64, moduleId int64)

func (*TypeSession) Value

func (session *TypeSession) Value(query string, args ...any) (result string, err error)

Jump to

Keyboard shortcuts

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