godatatables

package module
v0.0.0-...-6e2850e Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 9 Imported by: 0

README

godatatables

GoDoc

Server-side processing for DataTables in Go

See test/main.go for example usage.

TODO:

  • Regex search
  • Multiple column ordering
  • Check if column is searchable
  • Search specific columns
  • Regex search specific columns

Documentation

Overview

Package godatatables implements a function to handle a DataTables request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataTables

func DataTables(w http.ResponseWriter, r *http.Request, mysqlDb *sql.DB, t string, additionalWhere string, groupBy string, columns ...Column)

DataTables handles a client DataTables request. w is the http.ResponseWriter. r is the *http.Request. mysqlDb is an instance of *sql.Db t is the name of the database table additionalWhere is any additional where clause to be applied to the query. groupBy is the group by clause. Specify columns that should be present in the response.

Types

type Column

type Column struct {
	Name    string
	Search  string
	Display string
	Order   string
}

Column represents an SQL column. Name is the name of the column in the table. Search is how the column should be searched. Display is how the column should be rendered. Order is how the column should be ordered. If search, display, or order are blank, name will be used.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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