Versions in this module Expand all Collapse all v0 v0.2.0 Dec 27, 2025 Changes in this version + const CSRFFieldName + const EncryptionKeyCtxKey + const EngPostgres + const EngSQLite + const ErrBadRequest + const ErrCannotCreateResource + const ErrCannotDeleteResource + const ErrCannotGetResource + const ErrCannotGetResources + const ErrCannotRenderTemplate + const ErrCannotUpdateResource + const ErrCannotWriteResponse + const ErrInvalidBody + const ErrInvalidFormData + const ErrInvalidID + const ErrInvalidParam + const ErrResourceNotFound + const ErrTemplateNotFound + const ErrValidationFailed + const ErrorCodeBadRequest + const ErrorCodeInternalError + const ErrorCodeNotFound + const FlashCookieName + const FlashKey + const InternalAuthHeader + const MigrationPath + const MsgCreateItem + const MsgDeleteItem + const MsgGetAllItems + const MsgGetItem + const MsgUpdateItem + const NoSlug + const SecBypassAuth + const Slug + const StatusError + const StatusSuccess + const TimeFormat + var ErrDecryptionFailed = errors.New("decryption failed") + var ErrEncryptionFailed = errors.New("encryption failed") + var Flags = map[string]interface + var HTTPMethod = HTTPMethods + var Key = Keys + var NotificationType = notificationTypes + var ReqIDKey = contextKey("requestID") + var UserKey = contextKey("user") + func Add(a, b int) int + func AddPluralRule(plural, singular string) + func AddRelatedPath(i Identifiable, j Identifiable) string + func AddSingularRule(singular, plural string) + func AddUncountableRule(word string) + func AuthMw(app *App, sessionStore SessionStore, userService UserService) func(next http.Handler) http.Handler + func CORSMw(next http.Handler) http.Handler + func CSRFMw(cfg *Config) func(next http.Handler) http.Handler + func Cap(s string) string + func CreatePath(i Identifiable) string + func DebugFS(efs embed.FS, root string) error + func DefaultType(currentType string) string + func DeletePath(i Identifiable, id uuid.UUID) string + func EditPath(i Identifiable, id uuid.UUID) string + func EncryptionKeyMw(app *App) func(next http.Handler) http.Handler + func FieldMsg(form Form, field string, classes ...string) template.HTML + func GenID(i Identifiable) + func GenShortID(i Identifiable) + func InternalAuthMiddleware(app *App) func(next http.Handler) http.Handler + func IsHTMXRequest(r *http.Request) bool + func IsPlural(s string) bool + func IsSingular(s string) bool + func ListPath(i Identifiable) string + func ListRelatedPath(i Identifiable, j Identifiable, id uuid.UUID) string + func LogHeadersMw(next http.Handler) http.Handler + func MethodOverrideMw(next http.Handler) http.Handler + func Min(a, b int) int + func Mul(a, b int) int + func NewPath(i Identifiable) string + func Normalize(str string) string + func ParseUUID(s string) uuid.UUID + func PathID(r *http.Request, key string) (uuid.UUID, error) + func Plural(s string) string + func RemoveRelatedPath(i Identifiable, j Identifiable) string + func ReqID(r *http.Request) string + func RequestIDMw(next http.Handler) http.Handler + func Respond(w http.ResponseWriter, status int, response Response) + func SetCreateValues(m Model, userID ...uuid.UUID) + func SetUpdateValues(m Model, userID ...uuid.UUID) + func ShowPath(i Identifiable, id uuid.UUID) string + func Singular(s string) string + func StringPtr(s string) *string + func StringVal(s *string) string + func Sub(a, b int) int + func TimePtr(t time.Time) *time.Time + func TimeVal(t *time.Time) time.Time + func ToForm(r *http.Request, v interface{}, config ...FormConfig) error + func ToPtrSlice[T any](s []T) []*T + func Truncate(s string, length int) string + func TxFromContext(ctx context.Context) (interface{}, bool) + func UUIDPtr(id uuid.UUID) *string + func UUIDVal(s *string) uuid.UUID + func UpdatePath(i Identifiable) string + func ValidateEmail(email string) error + func WithTx(ctx context.Context, tx interface{}) context.Context + type APIClient struct + func NewAPIClient(name string, getToken func() string, baseURL string, params XParams) *APIClient + func (c *APIClient) Delete(r *http.Request, path string) error + func (c *APIClient) Get(r *http.Request, path string, target interface{}) error + func (c *APIClient) Post(r *http.Request, path string, body, target interface{}) error + func (c *APIClient) Put(r *http.Request, path string, body, target interface{}) error + type APIError struct + Code string + Details string + type APIHandler struct + func NewAPIHandler(name string, params XParams) *APIHandler + func (h *APIHandler) Created(w http.ResponseWriter, message string, data interface{}) + func (h *APIHandler) Err(w http.ResponseWriter, code int, message string, err error) + func (h *APIHandler) ID(w http.ResponseWriter, r *http.Request) (uuid.UUID, error) + func (h *APIHandler) OK(w http.ResponseWriter, message string, data interface{}) + func (h *APIHandler) Param(w http.ResponseWriter, r *http.Request, key string) (string, error) + type Action struct + IsForm bool + Path string + Style string + Text string + func DeleteAction(i Identifiable, id uuid.UUID, style string) Action + func EditAction(i Identifiable, id uuid.UUID, style string) Action + func ListAction(i Identifiable, style string) Action + func NewAction(url, text, style string) Action + type App struct + APIRouter *Router + InternalToken string + PreviewHandler http.Handler + Router *Router + Version string + func NewApp(name, version string, fs embed.FS, params XParams) *App + func (a *App) Add(dep Core) + func (a *App) Dep(name string) (*Dep, bool) + func (a *App) InternalAuthToken() string + func (a *App) MountAPI(path string, handler http.Handler) + func (a *App) MountFileServer(path string, fs *FileServer) + func (a *App) Setup(ctx context.Context) error + func (a *App) Start(ctx context.Context) error + func (a *App) StartServer(server *http.Server, addr string) + func (a *App) Stop(ctx context.Context) error + func (app *App) MountWeb(path string, handler http.Handler) + func (app *App) SetAPIRouter(router *Router) + func (app *App) SetWebRouter(router *Router) + type Auditable interface + GetCreatedAt func() time.Time + GetCreatedBy func() uuid.UUID + GetUpdatedAt func() time.Time + GetUpdatedBy func() uuid.UUID + SetCreatedAt func(time.Time) + SetCreatedBy func(uuid.UUID) + SetUpdatedAt func(time.Time) + SetUpdatedBy func(uuid.UUID) + type AuthMethod string + const AuthSSH + const AuthToken + type BaseCore struct + func NewCore(name string, params XParams) *BaseCore + func (c *BaseCore) Cfg() *Config + func (c *BaseCore) Log() Logger + func (c *BaseCore) Name() string + func (c *BaseCore) SetCfg(cfg *Config) + func (c *BaseCore) SetLog(log Logger) + func (c *BaseCore) SetName(name string) + func (c *BaseCore) SetOpts(opts ...Option) + func (c *BaseCore) Setup(ctx context.Context) error + func (c *BaseCore) Start(ctx context.Context) error + func (c *BaseCore) Stop(ctx context.Context) error + type BaseForm struct + func NewBaseForm(r *http.Request) *BaseForm + func (f *BaseForm) Action() string + func (f *BaseForm) Button() Button + func (f *BaseForm) CSRF() string + func (f *BaseForm) GenCSRFToken(r *http.Request) + func (f *BaseForm) HasErrors() bool + func (f *BaseForm) Method() string + func (f *BaseForm) SetAction(action string) + func (f *BaseForm) SetButton(button Button) + func (f *BaseForm) SetCSRF(csrf string) + func (f *BaseForm) SetMethod(method string) + func (f *BaseForm) SetSubmitButtonStyle(style string) + func (f *BaseForm) SetSubmitButtonText(text string) + func (f *BaseForm) SetValidation(validation *Validation) + func (f *BaseForm) Validation() *Validation + type BaseLogger struct + func NewLogger(logLevel string) *BaseLogger + func (l *BaseLogger) Debug(v ...any) + func (l *BaseLogger) Debugf(format string, a ...any) + func (l *BaseLogger) Error(v ...any) + func (l *BaseLogger) Errorf(format string, a ...any) + func (l *BaseLogger) Info(v ...any) + func (l *BaseLogger) Infof(format string, a ...any) + func (l *BaseLogger) SetDebugOutput(debug *bytes.Buffer) + func (l *BaseLogger) SetErrorOutput(error *bytes.Buffer) + func (l *BaseLogger) SetInfoOutput(info *bytes.Buffer) + func (l *BaseLogger) SetLogLevel(level LogLevel) + type BaseRepo struct + func NewRepo(name string, qm *QueryManager, params XParams) *BaseRepo + func (r *BaseRepo) Query() *QueryManager + func (r BaseRepo) BeginTx(ctx context.Context) (updatedCtx context.Context, tx Tx, err error) + type Button struct + Style string + Text string + type Config struct + func LoadCfg(namespace string, flagDefs map[string]interface{}) *Config + func NewConfig() *Config + func (cfg *Config) APIAddr() string + func (cfg *Config) BoolVal(key string, defVal bool, reload ...bool) (value bool) + func (cfg *Config) ByteSliceVal(key string, reload ...bool) []byte + func (cfg *Config) Debug() + func (cfg *Config) FloatVal(key string, defVal float64, reload ...bool) (value float64) + func (cfg *Config) Get(reload ...bool) map[string]string + func (cfg *Config) GetStr(key string, reload ...bool) (string, error) + func (cfg *Config) IntVal(key string, defVal int64, reload ...bool) (value int64) + func (cfg *Config) PreviewAddr() string + func (cfg *Config) Set(key string, value interface{}) + func (cfg *Config) SetNamespace(namespace string) + func (cfg *Config) SetValues(values map[string]string) + func (cfg *Config) StrVal(key string, reload ...bool) (value string, ok bool) + func (cfg *Config) StrValOrDef(key, defVal string, reload ...bool) (value string) + func (cfg *Config) WebAddr() string + type Configuring interface + Cfg func() *Config + SetCfg func(cfg *Config) + type Core interface + SetOpts func(opts ...Option) + type Crypto struct + func NewCrypto(key ...[]byte) *Crypto + func (c *Crypto) CheckPassword(hash []byte, password string) error + func (c *Crypto) DecryptEmail(ciphertext []byte) (string, error) + func (c *Crypto) EncryptEmail(email string) ([]byte, error) + func (c *Crypto) HashPassword(password string) ([]byte, error) + func (c *Crypto) SetKey(key []byte) + type Dep struct + Status Status + type Feat struct + Action string + Path string + PathSuffix string + type FileServer struct + func NewFileServer(fs embed.FS, params XParams) *FileServer + func (f *FileServer) Setup(ctx context.Context) error + func (f *FileServer) SetupRoutes() error + func (f *FileServer) SetupRoutesIndex() error + func (f *FileServer) SetupRoutesNoIndex() error + type Flash struct + Notifications []Notification + func NewFlash() Flash + func (f *Flash) Add(typ, msg string) + func (f *Flash) Clear() + func (f *Flash) HasMessages() bool + type FlashCtxKey string + type FlashManager struct + func NewFlashManager(params XParams) *FlashManager + func (fm *FlashManager) AddFlash(r *http.Request, typ, msg string) + func (fm *FlashManager) ClearFlash(w http.ResponseWriter, r *http.Request) + func (fm *FlashManager) ClearFlashCookie(w http.ResponseWriter) + func (fm *FlashManager) GetFlash(r *http.Request) Flash + func (fm *FlashManager) GetFlashFromCookie(r *http.Request) Flash + func (fm *FlashManager) Middleware(next http.Handler) http.Handler + func (fm *FlashManager) Middlewares() []Middleware + func (fm *FlashManager) SaveFlash(r *http.Request, flash Flash) + func (fm *FlashManager) SetFlashInCookie(w http.ResponseWriter, flash Flash) + func (fm *FlashManager) Setup(ctx context.Context) error + type Form interface + Action func() string + Button func() Button + CSRF func() string + GenCSRFToken func(r *http.Request) + HasErrors func() bool + Method func() string + SetAction func(action string) + SetButton func(button Button) + SetCSRF func(csrf string) + SetMethod func(method string) + SetSubmitButtonStyle func(style string) + SetSubmitButtonText func(text string) + SetValidation func(validation *Validation) + Validation func() *Validation + type FormConfig struct + FieldTag string + RequiredTag string + func DefaultFormConfig() FormConfig + type FormField struct + Convert TypeConverter + Name string + Required bool + Type reflect.Type + type FormMapper struct + func NewFormMapper(v interface{}, config ...FormConfig) (*FormMapper, error) + func (m *FormMapper) MapForm(r *http.Request, v interface{}) error + type GitAuth struct + Method AuthMethod + Token string + type GitClient interface + Add func(ctx context.Context, localRepoPath, pathspec string, env []string) error + Checkout func(ctx context.Context, localRepoPath, branch string, create bool, env []string) error + Clone func(ctx context.Context, repoURL, localPath string, auth GitAuth, env []string) error + Commit func(ctx context.Context, localRepoPath string, commit GitCommit, env []string) (string, error) + GitLog func(ctx context.Context, localRepoPath string, args []string, env []string) (string, error) + Push func(ctx context.Context, localRepoPath string, auth GitAuth, remote, branch string, ...) error + Status func(ctx context.Context, localRepoPath string, env []string) (string, error) + type GitCommit struct + Message string + UserEmail string + UserName string + type HTTPMethods struct + DELETE string + GET string + HEAD string + PATCH string + POST string + PUT string + type Handler struct + func NewHandler(name string, params XParams) *Handler + func (h *Handler) Err(w http.ResponseWriter, err error, msg string, code int) + func (h *Handler) ID(w http.ResponseWriter, r *http.Request) (uuid.UUID, error) + func (h *Handler) ParseUUIDFromQuery(r *http.Request, paramName string) (uuid.UUID, error) + func (h *Handler) ParseUUIDsFromQuery(w http.ResponseWriter, r *http.Request, paramName string) ([]uuid.UUID, bool) + func (h *Handler) Redir(w http.ResponseWriter, r *http.Request, path string) + func (h *Handler) Render(w http.ResponseWriter, r *http.Request, template string, data any) error + func (h *Handler) ShowItem(w http.ResponseWriter, r *http.Request, getter func(uuid.UUID) (any, error), ...) bool + type Identifiable interface + GenID func() + GenShortID func() + GetID func() uuid.UUID + GetShortID func() string + SetID func(id uuid.UUID, force ...bool) + SetShortID func(shortID string, force ...bool) + Slug func() string + Type func() string + type JSONSeed struct + Content string + Datetime string + Name string + type JSONSeeder struct + func NewJSONSeeder(feat string, assetsFS embed.FS, engine string, params XParams) *JSONSeeder + func (s *JSONSeeder) ApplyJSONSeed(datetime, name, context, content string) error + func (s *JSONSeeder) LoadJSONSeeds() (map[string][]JSONSeed, error) + func (s *JSONSeeder) SeedApplied(datetime, name, context string) (bool, error) + func (s *JSONSeeder) Setup(ctx context.Context) error + type Keys struct + AppEnv string + ButtonStyleBlue string + ButtonStyleGray string + ButtonStyleGreen string + ButtonStyleRed string + ButtonStyleYellow string + DBSQLiteDSN string + NotificationDebugStyle string + NotificationErrorStyle string + NotificationInfoStyle string + NotificationSuccessStyle string + NotificationWarnStyle string + RenderAPIErrors string + RenderWebErrors string + SecBlockKey string + SecBypassAuth string + SecCSRFKey string + SecCSRFRedirect string + SecEncryptionKey string + SecHashKey string + ServerAPIEnabled string + ServerAPIHost string + ServerAPIPort string + ServerIndexEnabled string + ServerPreviewEnabled string + ServerPreviewHost string + ServerPreviewPort string + ServerResPath string + ServerWebEnabled string + ServerWebHost string + ServerWebPort string + type Lifecycle interface + Setup func(ctx context.Context) error + Start func(ctx context.Context) error + Stop func(ctx context.Context) error + type LogLevel int + const DebugLevel + const ErrorLevel + const InfoLevel + func ToValidLevel(level string) LogLevel + type Logger interface + Debug func(v ...any) + Debugf func(format string, a ...any) + Error func(v ...any) + Errorf func(format string, a ...any) + Info func(v ...any) + Infof func(format string, a ...any) + SetLogLevel func(level LogLevel) + type Logging interface + Log func() Logger + SetLog func(log Logger) + type Menu struct + CSRFToken string + Items []MenuItem + Path string + func NewMenu(paths ...string) *Menu + func (m *Menu) AddDeleteItem(i Identifiable, text ...string) + func (m *Menu) AddEditItem(i Identifiable, text ...string) + func (m *Menu) AddGenericItem(action, url string, text ...string) + func (m *Menu) AddListItem(resource Identifiable, text ...string) + func (m *Menu) AddNewItem(r Identifiable, text ...string) + func (m *Menu) AddResDeleteItem(i Identifiable, text ...string) + func (m *Menu) AddResEditItem(i Identifiable, text ...string) + func (m *Menu) AddResGenericItem(action, id string, text ...string) + func (m *Menu) AddResListItem(resource Identifiable, text ...string) + func (m *Menu) AddResNewItem(resourceType string, text ...string) + func (m *Menu) AddResShowItem(i Identifiable, text ...string) + func (m *Menu) AddShowItem(i Identifiable, text ...string) + type MenuItem struct + CSRFToken string + Feat Feat + IsForm bool + Method string + QueryParams map[string]string + Style MenuItemStyle + Text string + func (i *MenuItem) GenLinkButton() string + func (i *MenuItem) GenPath() string + func (i *MenuItem) Path() string + type MenuItemStyle string + const BtnDangerStyle + const BtnGenericStyle + const BtnInfoStyle + const BtnPrimaryStyle + const BtnSecondaryStyle + const BtnWarningStyle + type Middleware func(http.Handler) http.Handler + type Migration struct + Datetime string + Down string + Name string + Up string + type Migrator struct + func NewMigrator(assetsFS embed.FS, engine string, params XParams) *Migrator + func (m *Migrator) Migrate(pendingMigrations []Migration) error + func (m *Migrator) SetDB(db *sql.DB) + func (m *Migrator) SetPath(path string) + func (m *Migrator) Setup(ctx context.Context) error + func (m *Migrator) SetupMigrations() error + func (m *Migrator) Start(ctx context.Context) error + type Model interface + type Naming interface + Name func() string + SetName func(name string) + type Notification struct + Msg string + Type string + type Option func(Core) + func WithConfigValue(key string, value interface{}) Option + type Page struct + Data any + Entities []any + Entity any + Feat Feat + Flash Flash + Form Form + IsNew bool + Menu *Menu + Name string + Select map[string][]SelectOpt + Title string + func NewPage(r *http.Request, data interface{}) *Page + func (p *Page) AddSelect(key string, values []SelectOpt) + func (p *Page) GenCSRFToken(r *http.Request) + func (p *Page) GetSelects(key string) []SelectOpt + func (p *Page) NewMenu(paths ...string) *Menu + func (p *Page) Path(feat Feat, item MenuItem) string + func (p *Page) SetData(data interface{}) + func (p *Page) SetFeat(feat Feat) + func (p *Page) SetFlash(flash Flash) + func (p *Page) SetForm(form Form) + func (p *Page) SetMenuItems(items []MenuItem) + func (p *Page) SetSelects(selects map[string][]SelectOpt) + type QueryManager struct + func NewQueryManager(assetsFS embed.FS, engine string, params XParams) *QueryManager + func (qm *QueryManager) Debug() + func (qm *QueryManager) Get(feat, resource, queryName string) (string, error) + func (qm *QueryManager) Load() + func (qm *QueryManager) Setup(ctx context.Context) error + type Repo interface + BeginTx func(ctx context.Context) (context.Context, Tx, error) + Query func() *QueryManager + type Response struct + Data interface{} + Error *APIError + Message string + Status string + func NewErrorResponse(message, code, details string) Response + func NewSuccessResponse(message string, data interface{}) Response + type Router struct + func NewAPIRouter(name string, params XParams) *Router + func NewRouter(name string, params XParams) *Router + func NewWebRouter(name string, params XParams) *Router + func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) + func (r *Router) SetMiddlewares(mws []Middleware) + type Seedable interface + Ref func() string + SetRef func(ref string) + type SelectOpt struct + Label string + Value string + func ToSelectOpt[T Selectable](in []T) []SelectOpt + type Selectable interface + OptLabel func() string + OptValue func() string + type Server struct + func NewServer(hostKey, portKey string, handler http.Handler, params XParams) *Server + func (s *Server) Start() + type Service struct + Crypto *Crypto + func NewService(name string, params XParams) *Service + type SessionStore interface + GetUserFromSession func(ctx context.Context, sessionID string) (uuid.UUID, error) + type Stampable interface + GenCreateValues func(userID ...uuid.UUID) + GenUpdateValues func(userID ...uuid.UUID) + type Status string + const Disabled + const Initialized + const Started + const Stopped + type TemplateManager struct + func NewTemplateManager(assetsFS embed.FS, params XParams) *TemplateManager + func (tm *TemplateManager) Debug() + func (tm *TemplateManager) Get(handler, action string) (*template.Template, error) + func (tm *TemplateManager) Load() + func (tm *TemplateManager) RegisterFuncs(tmpl *template.Template) *template.Template + func (tm *TemplateManager) RegisterFunctions(funcs template.FuncMap) + func (tm *TemplateManager) Setup(ctx context.Context) error + type Tx interface + Commit func() error + Rollback func() error + type TypeConverter func(string) (interface{}, error) + type UserCtxData struct + ContextualPermissions map[uuid.UUID]uuid.UUID + ID uuid.UUID + Permissions []uuid.UUID + func GetUserCtxData(ctx context.Context) *UserCtxData + type UserService interface + GetUserByID func(ctx context.Context, userID uuid.UUID) (*UserCtxData, error) + type Validate func(entity any) error + type Validation struct + Errors []string + Fields map[string]ValidationField + func (v *Validation) Add(err string) + func (v *Validation) AddFieldError(field, value, message string) + func (v Validation) Error() string + func (v Validation) FieldMsg(field string) string + func (v Validation) HasErrors() bool + func (v Validation) IsValid() bool + func (v Validation) JSON() string + type ValidationField struct + Message string + Name string + Value string + type Validator func(v any) (Validation, error) + func ComposeValidators(fns ...Validator) Validator + func ComposeValidatorsStrict(fns ...Validator) Validator + func Equals(field, a, b string) Validator + func GreaterThan(field string, a, b int) Validator + func MaxLength(field, val string, max int) Validator + func MinLength(field, val string, min int) Validator + type WebHandler struct + func NewWebHandler(tm *TemplateManager, fm *FlashManager, params XParams) *WebHandler + func (h *WebHandler) Debug(w http.ResponseWriter, r *http.Request, msg string) + func (h *WebHandler) FlashError(w http.ResponseWriter, r *http.Request, msg string) + func (h *WebHandler) FlashInfo(w http.ResponseWriter, r *http.Request, msg string) + func (h *WebHandler) FlashManager() *FlashManager + func (h *WebHandler) FlashSuccess(w http.ResponseWriter, r *http.Request, msg string) + func (h *WebHandler) FlashWarn(w http.ResponseWriter, r *http.Request, msg string) + func (h *WebHandler) GetFlash(r *http.Request) Flash + func (h *WebHandler) OK(w http.ResponseWriter, r *http.Request, buf *bytes.Buffer, statusCode int) + func (h *WebHandler) Redir(w http.ResponseWriter, r *http.Request, path string, status int) + func (h *WebHandler) Tmpl() *TemplateManager + type XParams struct + Cfg *Config + Log Logger v0.1.0 Oct 8, 2025