table

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/// Default/no options.
	DEFAULT = 0

	/// Treat this column as a primary key.
	INDEX = 1

	/// This column MUST be included in the github.com/dean2021/sysql predicate.
	REQUIRED = 2

	/*
	 * @brief This column is used to generate additional information.
	 *
	 * If this column is included in the github.com/dean2021/sysql predicate, the tables will generate
	 * additional information. Consider the browser_plugins or shell history
	 * tables: by default they list the tables or history relative to the user
	 * running the github.com/dean2021/sysql. However, if the calling github.com/dean2021/sysql specifies a UID explicitly
	 * in the predicate, the meaning of the tables changes and results for that
	 * user are returned instead.
	 */
	ADDITIONAL = 4

	/*
	 * @brief This column can be used to optimize the github.com/dean2021/sysql.
	 *
	 * If this column is included in the github.com/dean2021/sysql predicate, the tables will generate
	 * optimized information. Consider the system_controls tables, a default filter
	 * without a github.com/dean2021/sysql predicate lists all of the keys. When a specific domain is
	 * included in the predicate then the tables will only issue syscalls/lookups
	 * for that domain, greatly optimizing the time and utilization.
	 *
	 * This optimization does not mean the column is an index.
	 */
	OPTIMIZED = 8

	/// This column should be hidden from '*” selects.
	HIDDEN = 16
)
View Source
const (
	EQUALS                 = 2
	GREATER_THAN           = 4
	LESS_THAN_OR_EQUALS    = 8
	LESS_THAN              = 16
	GREATER_THAN_OR_EQUALS = 32
	MATCH                  = 64
	LIKE                   = 65
	GLOB                   = 66
	REGEXP                 = 67
	UNIQUE                 = 1
)

ConstraintOperator

View Source
const (
	UNKNOWN_TYPE int = iota
	TEXT_TYPE
	INTEGER_TYPE
	BIGINT_TYPE
	UNSIGNED_BIGINT_TYPE
	DOUBLE_TYPE
	BLOB_TYPE
)

Variables

View Source
var ColumnOptionsNames = map[int]string{
	HIDDEN:     "HIDDEN",
	OPTIMIZED:  "OPTIMIZED",
	ADDITIONAL: "ADDITIONAL",
	REQUIRED:   "REQUIRED",
	INDEX:      "INDEX",
	DEFAULT:    "DEFAULT",
}
View Source
var ColumnTypeNames = map[int]string{
	UNKNOWN_TYPE:         "UNKNOWN",
	TEXT_TYPE:            "TEXT",
	INTEGER_TYPE:         "INTEGER",
	BIGINT_TYPE:          "BIGINT",
	UNSIGNED_BIGINT_TYPE: "UNSIGNED BIGINT",
	DOUBLE_TYPE:          "DOUBLE",
	BLOB_TYPE:            "BLOB",
}

Functions

func ColumnDefinition

func ColumnDefinition(columns TableColumns) (statement string)

func GetAll

func GetAll() map[string]Table

func Register

func Register(tp Table, pluginName string) error

func SensibleComparison

func SensibleComparison(columnType int, op sqlite3.Op) bool

Types

type Column

type Column struct {
	Name    string
	Type    int
	Options int
}

type Constraint

type Constraint struct {
	Name string
	Op   sqlite3.Op
	Expr interface{}
}

type ConstraintSet

type ConstraintSet []Constraint

type Constraints

type Constraints []Constraint

func (*Constraints) Count

func (c *Constraints) Count(columnName string) int

func (*Constraints) Exists

func (c *Constraints) Exists(columnName string, op int) bool

func (*Constraints) GetAll

func (c *Constraints) GetAll(columnName string, op int) []interface{}

func (*Constraints) Size

func (c *Constraints) Size() int

type Pair

type Pair struct {
}

type QueryContext

type QueryContext struct {
	Constraints Constraints
}

type Table

type Table interface {
	Name() string
	Columns() TableColumns
	Generate(context *QueryContext) (TableRows, error)
}

func Get

func Get(tableName string) Table

type TableColumns

type TableColumns []Column

type TableRow

type TableRow map[string]interface{}

type TableRows

type TableRows []TableRow

type UsedColumns

type UsedColumns []string

Jump to

Keyboard shortcuts

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