Versions in this module Expand all Collapse all v0 v0.1.0 Mar 26, 2026 Changes in this version + const CodeBadUserInput + const CodeForbidden + const CodeGraphQLParseFailed + const CodeGraphQLValidationFailed + const CodeInternalServerError + const CodeNotFound + const CodeUnauthenticated + var AuditHook func(ctx *Context, actionTypeID int, ...) error + var ConfigReloadFunc func() (any, []string, error) + var ConnectionNamesFunc func() []string + var ConnectionSwapFunc func(name, driver, dsn string) error + var Connections = map[string]*sql.DB + var DB *sql.DB + var EncryptionKey []byte + var EncryptionKeyNext []byte + var ErrNoVisibilityScope = fmt.Errorf(...) + var ErrUnauthorized = &UnauthorizedActionError + var GenesisHash = make([]byte, 32) + var ManagedConnections = &connectionMap + func AuditDenied(ctx *Context, action, model string, resourceID any, reason string) + func AuditFailed(ctx *Context, action, model string, resourceID any, err error) + func AuditPerformed(ctx *Context, action, model string, resourceID any) + func Env(key, fallback string) string + func InitRuntimeConfig() + func OpenDB(conn ConnectionConfig) *sql.DB + func PlaygroundHandler(endpoint string) http.Handler + func RegisterPickleEndpoints(mux *http.ServeMux) + func SetIntrospection(allow bool) + func TransactionOn(db *sql.DB, fn func(tx *Tx) error) error + func VerifyProof(proof *MerkleProof) bool + func WithTransaction(fn func(tx *Tx) error) error + func WrapConnection(name string, db *sql.DB) + type App struct + func BuildApp(initFn func(), serveFn func(), cmds ...Command) *App + func (a *App) PrintCommands() + func (a *App) Run(args []string) + type AuthClaims struct + Role string + UserID string + type AuthInfo struct + Claims any + Role string + UserID string + type AuthRateLimitConfig struct + func AuthRateLimit() *AuthRateLimitConfig + func (c *AuthRateLimitConfig) Burst(burst int) *AuthRateLimitConfig + func (c *AuthRateLimitConfig) KeyFunc(fn func(*Context) string) *AuthRateLimitConfig + func (c *AuthRateLimitConfig) Middleware() MiddlewareFunc + func (c *AuthRateLimitConfig) RPS(rps float64) *AuthRateLimitConfig + func (c *AuthRateLimitConfig) Tiers(tiers map[string]RateTier) *AuthRateLimitConfig + type ChainError struct + Actual []byte + Expected []byte + Position int + RowID string + Table string + func (e *ChainError) Error() string + type ColumnMeta struct + Name string + TypeTag byte + type Command interface + Description func() string + Name func() string + Run func(args []string) error + type ConnectionConfig struct + Driver string + Host string + Name string + Options map[string]string + Password string + Port string + Region string + User string + func (c ConnectionConfig) DSN() string + type Context struct + func NewContext(w http.ResponseWriter, r *http.Request) *Context + func (c *Context) Auth() *AuthInfo + func (c *Context) BadRequest(msg string) Response + func (c *Context) BearerToken() string + func (c *Context) Cookie(name string) (string, error) + func (c *Context) Error(err error) Response + func (c *Context) Forbidden(msg string) Response + func (c *Context) HasAnyRole(slugs ...string) bool + func (c *Context) HasRole(slug string) bool + func (c *Context) IsAdmin() bool + func (c *Context) JSON(status int, data any) Response + func (c *Context) NoContent() Response + func (c *Context) NotFound(msg string) Response + func (c *Context) Param(name string) string + func (c *Context) ParamUUID(name string) (uuid.UUID, error) + func (c *Context) PeekJSON(field string) string + func (c *Context) Query(name string) string + func (c *Context) Request() *http.Request + func (c *Context) Resource(q ResourceQuery) Response + func (c *Context) Resources(q ResourceListQuery) Response + func (c *Context) ResponseWriter() http.ResponseWriter + func (c *Context) Role() string + func (c *Context) Roles() []string + func (c *Context) SetAuth(claims any) + func (c *Context) SetParam(name, value string) + func (c *Context) SetRoles(roles []RoleInfo) + func (c *Context) Unauthorized(msg string) Response + type Controller struct + type DeadlockError struct + Detail string + Table string + func (e *DeadlockError) Error() string + func (e *DeadlockError) HTTPStatus() int + type Document struct + Fields []Field + Name string + Operation string + Variables map[string]any + type EncryptionConfig struct + CurrentKeyEnv string + NextKeyEnv string + type ErrorReporter func(ctx *Context, err error) + type Field struct + Alias string + Args map[string]any + Name string + Selections []Field + type FieldError struct + Field string + Message string + type FilterOp struct + Column string + Operator string + Value string + type GraphQLError struct + Code string + Extensions map[string]any + Field string + Message string + func BadInput(msg string) *GraphQLError + func Forbidden(msg string) *GraphQLError + func InternalError(msg string) *GraphQLError + func NotFound(resource string) *GraphQLError + func Unauthenticated(msg string) *GraphQLError + func (e *GraphQLError) Error() string + type HandlerFunc func(ctx *Context) Response + type ImmutableQueryBuilder struct + func ImmutableQuery[T any](table string, softDeletes bool, connection ...string) *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) All() ([]T, error) + func (q *ImmutableQueryBuilder[T]) AllVersions() *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) AnyOwner() *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) Count() (int64, error) + func (q *ImmutableQueryBuilder[T]) Create(record *T) error + func (q *ImmutableQueryBuilder[T]) EagerLoad(relation string) *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) First() (*T, error) + func (q *ImmutableQueryBuilder[T]) Limit(n int) *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) Lock() *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) LockForShare() *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) LockForUpdate() *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) NoWait() *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) Offset(n int) *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) OrderBy(column, direction string) *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) SkipLocked() *ImmutableQueryBuilder[T] + func (q *ImmutableQueryBuilder[T]) Timeout(d time.Duration) *ImmutableQueryBuilder[T] + type Job interface + Handle func() error + type JobEntry struct + Job Job + Schedule string + func (e *JobEntry) AllowOverlap() *JobEntry + func (e *JobEntry) MaxRetries(n int) *JobEntry + func (e *JobEntry) RetryDelay(d time.Duration) *JobEntry + func (e *JobEntry) SkipIfRunning() *JobEntry + func (e *JobEntry) Timeout(d time.Duration) *JobEntry + type LockHolder struct + Duration time.Duration + PID int + Query string + WaitCount int + type LockOutsideTransactionError struct + Table string + func (e *LockOutsideTransactionError) Error() string + func (e *LockOutsideTransactionError) HTTPStatus() int + type LockStatus struct + Holders []LockHolder + LockedRows int + Table string + Waiters int + type LockTimeoutError struct + Duration time.Duration + LockType string + Table string + func (e *LockTimeoutError) Error() string + func (e *LockTimeoutError) HTTPStatus() int + type ManagedConnection struct + DB *sql.DB + Name string + func (mc *ManagedConnection) Acquire() bool + func (mc *ManagedConnection) Release() + type MerkleCheckpoint struct + CheckpointID [16]byte + FirstRowID [16]byte + LastRowID [16]byte + PrevCheckpointID *[16]byte + RootHash []byte + RowCount int64 + type MerkleProof struct + CheckpointID [16]byte + RootHash []byte + RowHash []byte + Siblings []ProofNode + type MiddlewareFunc func(ctx *Context, next func() Response) Response + func RateLimit(rps float64, burst int) MiddlewareFunc + func RequireRole(roles ...string) MiddlewareFunc + type MiddlewareProvider interface + Middleware func() MiddlewareFunc + type NoWaitError struct + Table string + func (e *NoWaitError) Error() string + func (e *NoWaitError) HTTPStatus() int + type PageArgs struct + After string + Before string + First int + Last int + Offset int + type Pagination struct + Page int + PageSize int + Pages int + Total int64 + type ProofNode struct + Hash []byte + Left bool + type QueryBuilder struct + func ApplyScopeBuilder[T any](q *QueryBuilder[T], sb *ScopeBuilder[T]) *QueryBuilder[T] + func Query[T any](table string, connection ...string) *QueryBuilder[T] + func (q *QueryBuilder[T]) All() ([]T, error) + func (q *QueryBuilder[T]) AnyOwner() *QueryBuilder[T] + func (q *QueryBuilder[T]) Count() (int64, error) + func (q *QueryBuilder[T]) Create(record *T) error + func (q *QueryBuilder[T]) Delete(record *T) error + func (q *QueryBuilder[T]) EagerLoad(relation string) *QueryBuilder[T] + func (q *QueryBuilder[T]) First() (*T, error) + func (q *QueryBuilder[T]) Limit(n int) *QueryBuilder[T] + func (q *QueryBuilder[T]) Lock() *QueryBuilder[T] + func (q *QueryBuilder[T]) LockForShare() *QueryBuilder[T] + func (q *QueryBuilder[T]) LockForUpdate() *QueryBuilder[T] + func (q *QueryBuilder[T]) NoWait() *QueryBuilder[T] + func (q *QueryBuilder[T]) Offset(n int) *QueryBuilder[T] + func (q *QueryBuilder[T]) OrderBy(column, direction string) *QueryBuilder[T] + func (q *QueryBuilder[T]) SkipLocked() *QueryBuilder[T] + func (q *QueryBuilder[T]) Timeout(d time.Duration) *QueryBuilder[T] + func (q *QueryBuilder[T]) Update(record *T) error + type RateLimitEvent struct + Allowed bool + Burst int + Key string + Layer string + Path string + RPS float64 + Remaining float64 + type RateTier struct + Burst int + RPS float64 + type ResolveContext struct + func (c *ResolveContext) CanSeeOwnerFields(ownerID string) bool + func (c *ResolveContext) HasRole(role string) bool + func (c *ResolveContext) IsAuthenticated() bool + func (c *ResolveContext) UserID() string + func (c *ResolveContext) Visibility() VisibilityTier + type ResourceController interface + Destroy func(*Context) Response + Index func(*Context) Response + Show func(*Context) Response + Store func(*Context) Response + Update func(*Context) Response + type ResourceListQuery interface + FetchResources func(ownerID string) (any, error) + type ResourceQuery interface + FetchResource func(ownerID string) (any, error) + type Response struct + Body any + Cookies []*http.Cookie + Headers map[string]string + StatusCode int + func RequireAdmin(ctx *Context, next func() Response) Response + func RunMiddleware(ctx *Context, middleware []MiddlewareFunc, handler func() Response) Response + func (r Response) Header(key, value string) Response + func (r Response) WithCookie(c *http.Cookie) Response + func (r Response) Write(w http.ResponseWriter) + type RoleInfo struct + Manages bool + Slug string + type Route struct + Handler HandlerFunc + Method string + Middleware []MiddlewareFunc + Path string + type Router struct + func Routes(fn func(r *Router)) *Router + func (r *Router) AllRoutes() []Route + func (r *Router) Delete(path string, handler HandlerFunc, mw ...any) + func (r *Router) Get(path string, handler HandlerFunc, mw ...any) + func (r *Router) Group(prefix string, body func(*Router), mw ...any) + func (r *Router) ListenAndServe(addr string) error + func (r *Router) OnError(fn ErrorReporter) + func (r *Router) OnRateLimit(fn func(ctx *Context, event RateLimitEvent)) + func (r *Router) Patch(path string, handler HandlerFunc, mw ...any) + func (r *Router) Post(path string, handler HandlerFunc, mw ...any) + func (r *Router) Put(path string, handler HandlerFunc, mw ...any) + func (r *Router) RegisterRoutes(mux *http.ServeMux) + func (r *Router) Resource(prefix string, c ResourceController, mw ...any) + type RuntimeConfig struct + DatabaseDSNs map[string]string + EncryptionKey []byte + EncryptionKeyNext []byte + func Config() *RuntimeConfig + func ReloadConfig() (*RuntimeConfig, []string, error) + type Scheduler struct + func Cron(fn func(s *Scheduler)) *Scheduler + func (s *Scheduler) Entries() []*JobEntry + func (s *Scheduler) Job(schedule string, job Job) *JobEntry + func (s *Scheduler) Start(ctx context.Context) + type ScopeBuilder struct + func NewScopeBuilder[T any](q *QueryBuilder[T]) *ScopeBuilder[T] + func (sb *ScopeBuilder[T]) Limit(n int) *ScopeBuilder[T] + func (sb *ScopeBuilder[T]) Offset(n int) *ScopeBuilder[T] + func (sb *ScopeBuilder[T]) OrderBy(column, direction string) *ScopeBuilder[T] + type StaleVersionError struct + ActualVersion string + EntityID string + ExpectedVersion string + Table string + func (e *StaleVersionError) Error() string + func (e *StaleVersionError) HTTPStatus() int + type Tx struct + func (tx *Tx) Conn() *sql.Tx + func (tx *Tx) Transaction(fn func(tx *Tx) error) error + type UnauthorizedActionError struct + func (e *UnauthorizedActionError) Error() string + func (e *UnauthorizedActionError) HTTPStatus() int + type ValidationError struct + Fields []FieldError + func (e *ValidationError) Error() string + type VisibilityTier int + const VisibilityAll + const VisibilityOwner + const VisibilityPublic