Documentation ¶
Index ¶
- func CreateDataTablesHandler(cmd cmds.GlazeCommand, basePath string, downloadPath string, ...) echo.HandlerFunc
- func NewDataTablesLookupTemplate() *render.LookupTemplateFromFS
- type DataTables
- type QueryHandler
- type QueryHandlerOption
- func WithAdditionalData(data map[string]interface{}) QueryHandlerOption
- func WithDataTables(dt *DataTables) QueryHandlerOption
- func WithMiddlewares(middlewares ...middlewares.Middleware) QueryHandlerOption
- func WithStreamRows(streamRows bool) QueryHandlerOption
- func WithTemplateLookup(lookup render.TemplateLookup) QueryHandlerOption
- func WithTemplateName(templateName string) QueryHandlerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDataTablesHandler ¶
func CreateDataTablesHandler( cmd cmds.GlazeCommand, basePath string, downloadPath string, options ...QueryHandlerOption, ) echo.HandlerFunc
func NewDataTablesLookupTemplate ¶
func NewDataTablesLookupTemplate() *render.LookupTemplateFromFS
Types ¶
type DataTables ¶
type DataTables struct { Command *cmds.CommandDescription // LongDescription is the HTML of the rendered markdown of the long description of the command. LongDescription template.HTML Layout *layout.Layout Links []layout.Link BasePath string // Stream provides a channel where each element represents a row of the table // to be rendered, already formatted. // Per default, we will render the individual rows as HTML, but the JSRendering // flag will make this output individual entries of a JS array. // // TODO(manuel, 2023-06-04): Maybe we could make this be an iterator of rows that provide access to the individual // columns for more interesting HTML shenanigans too. JSStream chan template.JS HTMLStream chan template.HTML ErrorStream chan string // Configuring the template to load the table data through javascript, and provide the data itself // as a JSON array inlined in the HTML of the page. JSRendering bool Columns []string // UseDataTables is using the datatables.net framework. // This is an opinionated way of proposing different table layouts and javascript functionality // (for now). If a user wants more advanced customization, they can use the HTMLTemplateOutputFormatter // or use this implementation for inspiration. UseDataTables bool // AdditionalData to be passed to the rendering engine AdditionalData map[string]interface{} // StreamRows is used to control whether the rows should be streamed or not. // If set to false, a TableMiddleware used (which collects all rows, but thus also all column names) // into memory before passing them to the template. // This is useful when the rows are "ragged" (i.e. not all rows have the same number of columns). StreamRows bool CommandMetadata map[string]interface{} }
DataTables describes the data passed to the template displaying the results of a glazed command. It's meant to be a more structured layer on top of the HTMLOutputTemplateFormatter that parka offers for having users provide their own template formatting.
func NewDataTables ¶ added in v0.4.14
func NewDataTables() *DataTables
func (*DataTables) Clone ¶
func (dt *DataTables) Clone() *DataTables
type QueryHandler ¶
type QueryHandler struct {
// contains filtered or unexported fields
}
func NewQueryHandler ¶
func NewQueryHandler( cmd cmds.GlazeCommand, options ...QueryHandlerOption, ) *QueryHandler
func (*QueryHandler) Handle ¶
func (qh *QueryHandler) Handle(c echo.Context) error
type QueryHandlerOption ¶
type QueryHandlerOption func(qh *QueryHandler)
func WithAdditionalData ¶
func WithAdditionalData(data map[string]interface{}) QueryHandlerOption
func WithDataTables ¶
func WithDataTables(dt *DataTables) QueryHandlerOption
func WithMiddlewares ¶ added in v0.5.0
func WithMiddlewares(middlewares ...middlewares.Middleware) QueryHandlerOption
func WithStreamRows ¶ added in v0.4.5
func WithStreamRows(streamRows bool) QueryHandlerOption
func WithTemplateLookup ¶
func WithTemplateLookup(lookup render.TemplateLookup) QueryHandlerOption
func WithTemplateName ¶
func WithTemplateName(templateName string) QueryHandlerOption
Click to show internal directories.
Click to hide internal directories.