Documentation ¶
Index ¶
- Constants
- Variables
- func AddSearchResults(c *Context, field, token string, allRows map[int64]any)
- func CastFields(model *models.Model, m map[string]any)
- func CastFieldsPg(model *models.Model, m map[string]any)
- func CastFieldsSqlite(model *models.Model, m map[string]any)
- func CreateSession(c *Context)
- func Default404(r *Router, c *Context)
- func DestroySession(c *Context)
- func DollarSigns(size int) string
- func FetchOneRow(db *sqlx.DB, model *models.Model, guid string) map[string]any
- func Filelog(fields ...any)
- func GetCookie(c *Context, name string) string
- func GetEditableCols(c *Context, modelString string) ([]string, map[string]string)
- func HandleCreateSessionAutoForm(c *Context)
- func HandleCreateUserAutoForm(c *Context, username string) string
- func HandleSessions(c *Context, second, third string)
- func HashPassword(password string) string
- func InitNewApp(path string)
- func IsAdmin(user map[string]any) bool
- func IsEditable(item string, editable map[string]string) bool
- func LoadLiveTemplates(tf template.FuncMap) *template.Template
- func LoadTemplates(tf template.FuncMap) *template.Template
- func MakeGuidsInTable(db *sqlx.DB, model *models.Model)
- func MakeGuidsInTables(db *sqlx.DB, models []*models.Model)
- func MakeTable(db *sqlx.DB, model *models.Model)
- func MakeTables(db *sqlx.DB, models []*models.Model)
- func MakeWasmScript(tag, s string) template.HTML
- func MakeWasmScript2(tag, s string) template.HTML
- func Markup(c *Context, second, third string)
- func ModelsCreateWithId(c *Context, id string)
- func ModelsShow(c *Context, rawId string)
- func ModelsToBytes(list []*models.Model) []byte
- func NotLoggedIn(c *Context) bool
- func ParseNumbers(c *Context, cols []string, editable map[string]string)
- func Redirect(c *Context, path string)
- func RenderMarkup()
- func SaveMultiFilesAws(c *Context, guid string)
- func SetCookie(c *Context, name, value string)
- func SetCors(c *Context)
- func SetCorsOptions(c *Context)
- func SetFlash(c *Context, flash string)
- func SetUser(c *Context, guid, domain string)
- func StringIds(ids []any) []string
- func TemplateFunctions() template.FuncMap
- func TimezoneList(tz string) template.HTML
- type Batch
- type BatchWriter
- type Context
- func (c *Context) All(modelName string, where, offset string, params ...any) []map[string]any
- func (c *Context) AllIn(field, modelName string, offset, other string, tokens []any) []map[string]any
- func (c *Context) BodyAsString() string
- func (c *Context) CopyContext() *Context
- func (c *Context) Count(modelName string, whereString string, params []any) int64
- func (c *Context) Decorate(list []map[string]any) []string
- func (c *Context) DecorateList(list []map[string]any)
- func (c *Context) DecorateListWithFields(list []map[string]any, fields map[string]bool)
- func (c *Context) DecorateSingle(item map[string]any)
- func (c *Context) Delete(modelName, fieldName string, id any)
- func (c *Context) ExecuteTemplate(filename string, vars any)
- func (c *Context) FindModel(name string) *models.Model
- func (c *Context) FreeFormSelect(sql string, params ...any) []map[string]any
- func (c *Context) FreeFormUpdate(sql string, params ...any) error
- func (c *Context) FunctionToRun(route string, user map[string]any) *Batch
- func (c *Context) Insert(modelString string) string
- func (c *Context) LookupUser(guid string) map[string]any
- func (c *Context) LookupUserByToken(token string) map[string]any
- func (c *Context) LookupUsername(username string) map[string]any
- func (c *Context) MakeCells(list []any, headers []string, thing any, prefix string) [][]any
- func (c *Context) Model(modelName string) *models.Model
- func (c *Context) Models() []*models.Model
- func (c *Context) One(modelName string, where string, params ...any) map[string]any
- func (c *Context) OneWithIndex(index int64, modelName string, where string, params ...any) map[string]any
- func (c *Context) ReadFormPost()
- func (c *Context) ReadFormValuesIntoParams(list ...string)
- func (c *Context) ReadJsonBodyAsArray() []any
- func (c *Context) ReadJsonBodyIntoParams()
- func (c *Context) ReadJsonBodyIntoParamsWithLog(file string)
- func (c *Context) ReadMultipleFormValues(list ...string)
- func (c *Context) RegexMap(s string) map[string]string
- func (c *Context) SelectAll(modelName string, where string, params []any, offset string) []map[string]any
- func (c *Context) SelectOne(modelName string, where string, params []any) map[string]any
- func (c *Context) SendContentAsJson(thing any, status int)
- func (c *Context) SendContentAsJsonMessage(message string, status int)
- func (c *Context) SendContentForAjax(doZip bool, user map[string]any, writer http.ResponseWriter, filename string, ...)
- func (c *Context) SendContentInLayout(filename string, vars any, status int)
- func (c *Context) SendIntAsJson(wrapper string, val int64)
- func (c *Context) SendRowAsJson(wrapper string, row map[string]any)
- func (c *Context) TableJson(tableName string)
- func (c *Context) TableJsonParams(tableName, where string, params ...any)
- func (c *Context) Template(name string, vars any) template.HTML
- func (c *Context) TimezoneList(list []map[string]any, field1, field2 string, tz *time.Location)
- func (c *Context) Update(modelString, where string, lastParam any) string
- func (c *Context) UpdateOne(modelName, setString, whereString string, params []any) error
- func (c *Context) UpdateWithIndex(index int64, sql string, params ...any) error
- func (c *Context) Upsert(modelString, where string, lastParam any) string
- func (c *Context) Validate(create bool, fields []*models.Field) string
- func (c *Context) ValidateAndInsert(modelString string) string
- func (c *Context) ValidateAndUpsert(modelString, field string, val any) string
- func (c *Context) ValidateCreate(modelString string) string
- func (c *Context) ValidateOneField(modelString, fieldString, value string) bool
- func (c *Context) ValidateUpdate(modelString string) string
- func (c *Context) WhereIn(modelString string, ids []any) MI64MSA
- func (c *Context) WhereInList(modelString string, ids []any) []map[string]any
- func (c *Context) WhereInWithId(modelString, id string, ids []any) map[int64]map[string]any
- func (c *Context) WithIndex(index int64, sql string, params ...any) []map[string]any
- func (c *Context) Wrangle(s *FeedbackSite) *Context
- type FeedbackSite
- type FieldVars
- type MI64MSA
- type MSA
- type MSAS
- type MSMAB
- type ModelVars
- type ModelsVars
- type Router
- func (r *Router) All(modelName string, where, offset string, params ...any) []map[string]any
- func (r *Router) FindModel(name string) *models.Model
- func (r *Router) FreeFormSelect(sql string, params ...any) []map[string]any
- func (r *Router) FreeFormUpdate(sql string, params ...any) error
- func (r *Router) GetLiveOrCachedTemplate(name string) *template.Template
- func (r *Router) HandleAsset(path string, writer http.ResponseWriter, request *http.Request)
- func (r *Router) HandleBucketAsset(path string, writer http.ResponseWriter, request *http.Request)
- func (r *Router) ListenAndServe(port string)
- func (r *Router) ListenAndServeTLS()
- func (r *Router) LookupUser(guid string) map[string]any
- func (r *Router) LookupUserByToken(token string) map[string]any
- func (r *Router) LookupUsername(username string) map[string]any
- func (r *Router) One(modelName string, where string, params ...any) map[string]any
- func (r *Router) PlaceContentInLayoutMap(layoutMap map[string]any, flash string, user map[string]any, filename string, ...)
- func (r *Router) ResetDatabase()
- func (r *Router) RouteFromRequest(writer http.ResponseWriter, request *http.Request)
- func (r *Router) SelectAll(modelName string, where string, params []any, offset string) []map[string]any
- func (r *Router) SelectOne(modelName string, where string, params []any) map[string]any
- func (r *Router) SendContentInLayout(doZip bool, layout string, layoutMap map[string]any, flash string, ...)
- func (r *Router) ToContext() *Context
- func (r *Router) WhereInFull(modelString string, ids []any) []map[string]any
- type UploadedFile
Constants ¶
View Source
const ( KB = 1000 MB = KB * 1000 GB = MB * 1000 )
View Source
const DATE_LAYOUT = "Monday, January 2, 2006 15:04"
View Source
const HUMAN = "Monday, January 2, 2006 3:04 PM"
View Source
const HUMAN_SMALL = "01/02/2006"
Variables ¶
View Source
var BuildTag string
View Source
var CustomFuncMap *template.FuncMap
View Source
var DB_FLAVOR = "pg"
View Source
var EmbeddedAssets embed.FS
View Source
var EmbeddedTemplates embed.FS
View Source
var UseJsonToMakeTablesAndIndexes = true
View Source
var UseLiveTemplates = os.Getenv("USE_LIVE_TEMPLATES") == "true"
View Source
var WasmTag string
Functions ¶
func AddSearchResults ¶
func CreateSession ¶
func CreateSession(c *Context)
func Default404 ¶
func DestroySession ¶
func DestroySession(c *Context)
func DollarSigns ¶
func GetEditableCols ¶
func HandleCreateSessionAutoForm ¶
func HandleCreateSessionAutoForm(c *Context)
func HandleSessions ¶
func HashPassword ¶
func InitNewApp ¶
func InitNewApp(path string)
func MakeWasmScript ¶
func MakeWasmScript2 ¶
func ModelsCreateWithId ¶
func ModelsShow ¶
func ModelsToBytes ¶
func NotLoggedIn ¶
func RenderMarkup ¶
func RenderMarkup()
func SaveMultiFilesAws ¶
func SetCorsOptions ¶
func SetCorsOptions(c *Context)
func TemplateFunctions ¶
func TimezoneList ¶
Types ¶
type BatchWriter ¶
func NewBatchWriter ¶
func NewBatchWriter(route string) *BatchWriter
func (*BatchWriter) Header ¶
func (w *BatchWriter) Header() http.Header
func (*BatchWriter) WriteHeader ¶
func (w *BatchWriter) WriteHeader(statusCode int)
type Context ¶
type Context struct { Writer http.ResponseWriter Request *http.Request Router *Router User map[string]any UserRequired bool Db *sqlx.DB Dbs []*sqlx.DB NotFound bool Method string Layout string Params map[string]any Title string LayoutMap map[string]any ParamMutex sync.Mutex Client *http.Client Batch bool BatchThing any // contains filtered or unexported fields }
func PrepareContext ¶
func (*Context) BodyAsString ¶
func (*Context) CopyContext ¶
func (*Context) DecorateList ¶
func (*Context) DecorateListWithFields ¶
func (*Context) DecorateSingle ¶
func (*Context) ExecuteTemplate ¶
func (*Context) FreeFormSelect ¶
func (*Context) FunctionToRun ¶
func (*Context) LookupUserByToken ¶
func (*Context) OneWithIndex ¶
func (*Context) ReadFormPost ¶
func (c *Context) ReadFormPost()
func (*Context) ReadFormValuesIntoParams ¶
func (*Context) ReadJsonBodyAsArray ¶
func (*Context) ReadJsonBodyIntoParams ¶
func (c *Context) ReadJsonBodyIntoParams()
func (*Context) ReadJsonBodyIntoParamsWithLog ¶
func (*Context) ReadMultipleFormValues ¶
func (*Context) SendContentAsJson ¶
func (*Context) SendContentAsJsonMessage ¶
func (*Context) SendContentForAjax ¶
func (*Context) SendContentInLayout ¶
func (*Context) SendIntAsJson ¶
func (*Context) TableJsonParams ¶
func (*Context) TimezoneList ¶
func (*Context) UpdateWithIndex ¶
func (*Context) ValidateAndInsert ¶
func (*Context) ValidateAndUpsert ¶
func (*Context) ValidateCreate ¶
func (*Context) ValidateOneField ¶
func (*Context) ValidateUpdate ¶
func (*Context) WhereInList ¶
func (*Context) WhereInWithId ¶
func (*Context) Wrangle ¶
func (c *Context) Wrangle(s *FeedbackSite) *Context
type FeedbackSite ¶
type FeedbackSite struct { Title string `json:"title"` Models []*models.Model `json:"models"` Routes []*models.Route `json:"routes"` Dynamic []*models.Model `json:"dynamic"` }
func (*FeedbackSite) FindDynamic ¶
func (s *FeedbackSite) FindDynamic(id string) *models.Model
func (*FeedbackSite) FindModelOrDynamic ¶
func (s *FeedbackSite) FindModelOrDynamic(id string) *models.Model
type ModelsVars ¶
type Router ¶
type Router struct { Template *template.Template Site *FeedbackSite Db *sqlx.DB Dbs []*sqlx.DB WrangleDb *sqlx.DB Prefix string BucketPath string Paths map[string]func(*Context, string, string) BeforeCreate map[string]func(*Context) AfterCreate map[string]func(*Context, string) PathLock sync.Mutex AfterLock sync.Mutex BeforeLock sync.Mutex DefaultLayout string BearerAuthFunc func(*Context) map[string]any CookieAuthFunc func(*Context) map[string]any NotFoundFunc func(*Router, *Context) BeforeAll func(*Context) NotLoggedInPath string }
func (*Router) FreeFormSelect ¶
func (*Router) GetLiveOrCachedTemplate ¶
func (*Router) HandleAsset ¶
func (*Router) HandleBucketAsset ¶
func (*Router) ListenAndServe ¶
func (*Router) ListenAndServeTLS ¶
func (r *Router) ListenAndServeTLS()
func (*Router) PlaceContentInLayoutMap ¶
func (*Router) ResetDatabase ¶
func (r *Router) ResetDatabase()
func (*Router) RouteFromRequest ¶
func (r *Router) RouteFromRequest(writer http.ResponseWriter, request *http.Request)
func (*Router) SendContentInLayout ¶
type UploadedFile ¶
func SaveMultiFiles ¶
func SaveMultiFiles(c *Context, path, newName string) []UploadedFile
Source Files ¶
- about_controller.go
- admin_controller.go
- ajax.go
- api_controller.go
- app.go
- assets.go
- before_all.go
- bucket.go
- cells.go
- context.go
- context_copy.go
- context_database.go
- context_database_count.go
- context_database_model.go
- context_decorate.go
- context_delete.go
- context_free_form.go
- context_free_form_index.go
- context_json.go
- context_model.go
- context_one_with_index.go
- context_params.go
- context_template.go
- context_timezone.go
- context_where_in.go
- context_with_index.go
- cookies.go
- cors.go
- editable_cols.go
- feedback_site.go
- fields_controller.go
- filelog.go
- forms.go
- functions_to_run.go
- google_controller.go
- json.go
- markup.go
- model_user.go
- models_controller.go
- new.go
- parse.go
- path.go
- redirect.go
- regex.go
- reset.go
- search.go
- server.go
- sesssions_controller.go
- stats_controller.go
- tables.go
- templates.go
- upsert.go
- users_controller.go
- validate.go
- viewport.go
- wasm.go
- welcome_controller.go
- wrangle.go
- zippy.go
Click to show internal directories.
Click to hide internal directories.