structs

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnType

type ColumnType struct {
	ColumnName    string // the field alias
	OriginalName  string // internal working name
	Type          string
	SQLColumnType *sql.ColumnType
}

type Data

type Data struct {
	Db        string                                                                  //name of column
	Dt        interface{}                                                             //id of column in client (can be int or string)
	Cs        bool                                                                    //case sensitive - optional default false
	Sf        string                                                                  //Search Function - for custom functions declared in your ddbb
	Formatter func(data interface{}, row map[string]interface{}) (interface{}, error) //can run code in this function to edit results - optional, can be nil
}

Data is a line in map that link the database field with datatable field

type DataParsed added in v0.6.10

type DataParsed struct {
	Data

	ParsedDT string
}

type DialectFunctions

type DialectFunctions struct {

	/* Mandatory
	Must order properly
	1 param is column name in ddbb
	2 param must be "asc" or "desc"
	3 param is the column type array for check type
	4 optional params, can be nil

	return a sql string*/
	Order func(string, string, []ColumnType, map[string]interface{}) string

	/* Optional - can be empty function
	For configure ddbb
	1 gorm connection
	2 optional params, can be nil*/
	DBConfig func(*gorm.DB, map[string]interface{})

	/* Mandatory
	Build a query for a field
	1 the type of field
	2 the name of field
	3 value to search
	4 aditional ddbb raw column info
	5 if must exect a regular expression
	6 Data info if needed
	7 optional params, can be nil

	return 1 a query "?" is for search value
	retrun 2 the search value
	*/
	BindingTypesQuery func(string, string, string, ColumnType, bool, DataParsed, map[string]interface{}) (string, interface{})

	/* Mandatory
	Parse a field responded to be return Numbers to int...
	1 type of field in ddbb
	2 field name in datatable
	3 value to be parsed
	4 type of field raw
	5 optional params, can be nil

	return parsed value
	retrun a error to return
	*/
	ParseData func(string, string, interface{}, reflect.Type, ColumnType, map[string]interface{}) (interface{}, error)

	/* Optional - can be empty function
	Get field types
	1 ddbb
	2 tablename
	3 optional params, can be nil

	return [field name , type]*/
	BindTypes func(*gorm.DB, string, map[string]interface{}) map[string]string

	/* Mandatory
	Parse a field reserved.
	1 fieldname
	2 optional params, can be nil

	return parsed fieldname
	*/
	ParseReservedField func(string, map[string]interface{}) string

	/* Optional - Words to be scaped*/
	ReservedWords []string

	/* Mandatory - Character to scape names ej '\"'*/
	EscapeChar string

	/* Mandatory - Character for separate tableName from FieldName ej "."*/
	AliasSeparator string
}

type JoinData

type JoinData struct {
	Table string //name of column
	Alias string //id of column in client (int or string)
	Query string //case sensitive - optional default false
}

type MessageDataTable

type MessageDataTable struct {
	Draw            int           `json:"draw"`
	RecordsTotal    int64         `json:"recordsTotal"`
	RecordsFiltered int64         `json:"recordsFiltered"`
	Data            []interface{} `json:"data,nilasempty"`
}

MessageDataTable is the response object

Jump to

Keyboard shortcuts

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