Documentation
¶
Index ¶
- Constants
- func DataStoreHandler(tableStore TableStore) func(http.ResponseWriter, *http.Request, httprouter.Params)
- func DefaultStoreHandler(queryFunc func(*DefaultStore) *DefaultStore) func(http.ResponseWriter, *http.Request, httprouter.Params)
- func ParseKey(key string) []string
- func TreePostFormValues(values url.Values) map[string]interface{}
- type ColumnDefinition
- type DataTableOrder
- type DefaultStore
- func (ds *DefaultStore) AddRow(data *TableRow) error
- func (ds *DefaultStore) CreateRow(data map[string]interface{}) *TableRow
- func (ds *DefaultStore) FilterRow(row *TableRow, filter *SearchDefinition, rowSet RowSet) bool
- func (ds *DefaultStore) GetData() RowSet
- func (ds *DefaultStore) QueryData(sr *SearchRequest) *TableResult
- type RowSet
- type SearchDefinition
- type SearchRequest
- type SortableRowSet
- type TableResult
- type TableRow
- type TableStore
Constants ¶
View Source
const ( ORDER_DESC = DataTableOrder("desc") ORDER_ASC = DataTableOrder("asc") ORDER_UNDEFINED = DataTableOrder("") )
Variables ¶
This section is empty.
Functions ¶
func DataStoreHandler ¶
func DataStoreHandler(tableStore TableStore) func(http.ResponseWriter, *http.Request, httprouter.Params)
func DefaultStoreHandler ¶
func DefaultStoreHandler(queryFunc func(*DefaultStore) *DefaultStore) func(http.ResponseWriter, *http.Request, httprouter.Params)
func TreePostFormValues ¶
Types ¶
type ColumnDefinition ¶
type ColumnDefinition struct { Name string `json:"data"` Searchable bool `json:"searchable"` Orderable bool `json:"orderable"` Order DataTableOrder `json:"-"` Search *SearchDefinition `json:"search"` }
type DataTableOrder ¶
type DataTableOrder string
type DefaultStore ¶
type DefaultStore struct {
// contains filtered or unexported fields
}
func (*DefaultStore) AddRow ¶
func (ds *DefaultStore) AddRow(data *TableRow) error
func (*DefaultStore) CreateRow ¶
func (ds *DefaultStore) CreateRow(data map[string]interface{}) *TableRow
func (*DefaultStore) FilterRow ¶
func (ds *DefaultStore) FilterRow(row *TableRow, filter *SearchDefinition, rowSet RowSet) bool
func (*DefaultStore) GetData ¶
func (ds *DefaultStore) GetData() RowSet
func (*DefaultStore) QueryData ¶
func (ds *DefaultStore) QueryData(sr *SearchRequest) *TableResult
type RowSet ¶
type RowSet interface { GetRows() []*TableRow ColumnByName(string) *ColumnDefinition Add(*TableRow) error }
type SearchDefinition ¶
type SearchDefinition struct { Value string `json:"value"` Regexp bool `json:"regexp"` InvalidRegExp bool `json:"-"` // contains filtered or unexported fields }
func (*SearchDefinition) IsApplicable ¶
func (sd *SearchDefinition) IsApplicable() bool
func (*SearchDefinition) IsMatch ¶
func (sd *SearchDefinition) IsMatch(value string) bool
type SearchRequest ¶
type SearchRequest struct { Draw int `json:"draw"` Columns []*ColumnDefinition `json:"columns"` Start int `json:"start"` Length int `json:"length"` Search *SearchDefinition `json:"search"` }
func (*SearchRequest) End ¶
func (sr *SearchRequest) End() int
type SortableRowSet ¶
type SortableRowSet struct { Limit uint Start uint Rows *rbtree.Rbtree // contains filtered or unexported fields }
func (*SortableRowSet) Add ¶
func (rs *SortableRowSet) Add(row *TableRow) error
func (*SortableRowSet) ColumnByName ¶
func (rs *SortableRowSet) ColumnByName(name string) *ColumnDefinition
func (*SortableRowSet) GetRows ¶
func (rs *SortableRowSet) GetRows() []*TableRow
func (*SortableRowSet) IsLess ¶
func (rs *SortableRowSet) IsLess(origin *TableRow, than *TableRow) bool
func (*SortableRowSet) MarshalJSON ¶
func (rs *SortableRowSet) MarshalJSON() ([]byte, error)
type TableResult ¶
type TableRow ¶
type TableRow struct { Data map[string]interface{} RowId string RowClass string RowData map[string]string RowAttr map[string]string IsLess func(*TableRow, *TableRow) bool }
func (*TableRow) MarshalJSON ¶
type TableStore ¶
type TableStore interface {
QueryData(*SearchRequest) *TableResult
}
Click to show internal directories.
Click to hide internal directories.