Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultLimit = 100 DefaultMaxLimit = 1000 DefaultMinLimit = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClampWithDefault ¶
type Config ¶
type Config struct {
Entities []Entity `yaml:"entities"`
Project ProjectConfg
Queries QueriesConfig
Paginator PaginatorConfig `yaml:"paginators"`
}
All paths are relative to that of the configuration file
type Entity ¶
type Entity struct {
Name string // Name of the Entity used in user interface
SqlcType string `yaml:"sqlc_type"` // Name of the sqlc generated type representing that table
Table string // Name of the database table
Select []string // unused
Joins []string // Joins to added, form of '<table> on <cond>', `join` is automatically added
Where []string // Additional where conditions `foo = bar`, they're all automatically ANDed
PrimaryKey string `yaml:"primary_key"` // name of the primary key column
SortKeys []SortColumn `yaml:"sort_keys"` // list of additional columns we can sort on
DefaultSortColumn string `yaml:"default_sort_column"` // name of the default column to sort on, must be in SortKeys
DefaultDirection string `yaml:"default_direction"` // default order direction
DefaultLimit uint `yaml:"default_limit"` // by default only return this number of rows max
RequiredExternalVals []ExternalVal `yaml:"provided_values"` // name and type of fields required by the paginator which cannot be inferred from the request
}
Entity describes something we want to paginate. It's backed by one table with a bigint primary key and one or more sort columns. Primary key plus a sort column form a keyset that can be paginated over.
func (Entity) PaginatedType ¶
func (Entity) PaginatorType ¶
func (Entity) SortColumnByName ¶
func (e Entity) SortColumnByName(name string) SortColumn
type ExternalVal ¶
type PaginatorConfig ¶
type ProjectConfg ¶
type QueriesConfig ¶
type QueriesConfig struct {
File string
Package string // Package the generated packages go into
Limit ClampWithDefault
// contains filtered or unexported fields
}
type SortColumn ¶
type SortColumn struct {
Name string
Title string
DefaultDirection string `yaml:"default_direction"`
Type string // We need to know the type to parse and we need to know if it needs to be encoded
Prefix string
}
func (SortColumn) ColumnName ¶
func (s SortColumn) ColumnName() string
Click to show internal directories.
Click to hide internal directories.