Skip to main content

Nucleus API surface

The public Go API of Nucleus v1.33.0, the version Quantum 1.42.0 certifies: 2,499 exported symbols in 31 packages. Nucleus keeps this list in contracts/baseline/api_exported_symbols.txt. Nucleus's CI compares this file with the code on every change and fails when they differ, so adding or removing an exported symbol means changing the file in the same change. Removing an exported symbol is a breaking change, and the suite ships breaking changes only in a major version. This page is generated from that file at the pinned version, so it lists exactly what the check protects.

Each package links to its documentation on pkg.go.dev at this version, where every symbol has its signature and its comment.

PackageTypesFunctionsMethodsFieldsConstantsVariables
pkg/accounts141060412413
pkg/app28333021019
pkg/auth303110743126
pkg/auth/apikeys58121262
pkg/auth/backend44583
pkg/auth/backend/backendtest115
pkg/auth/federated84582
pkg/auth/federated/oidc21381
pkg/auth/sessionstore3436
pkg/authz81125121
pkg/circuit314531
pkg/db139153974
pkg/db/driver15
pkg/db/driver/drivertest114
pkg/errors111112231
pkg/health3734
pkg/mail101012253
pkg/model201319100133
pkg/nucleus4237117841715
pkg/observability136363710
pkg/observability/hooks53316
pkg/observe21571
pkg/observe/exporter347
pkg/plugins2014156814
pkg/router175958518
pkg/router/interceptor4522
pkg/signals7612686
pkg/storage261435261
pkg/storage/provider19914616
pkg/tasks154178464
pkg/validate2

pkg/accounts​

github.com/jcsvwinston/nucleus/pkg/accounts · 162 symbols · pkg.go.dev

Types

  • Account — fields CreatedAt, Disabled, Email, EmailVerified, ID, PasswordHash, Role, UpdatedAt, Username
  • Config — fields BaseURL, From, Issuer, LockoutBase, LockoutThreshold, LockoutWindow, MFAEncryptionKey, MagicLinkTTL, MinPasswordLength, RequireEmailVerification, ResetTokenTTL, VerifyTokenTTL
  • Factor — fields AccountID, Confirmed, CreatedAt, Kind, LastStep, Secret
  • FactorKind
  • Flavor
  • MFAStore interface — methods ConsumeRecoveryCode, CountRecoveryCodes, DeleteFactor, GetFactor, PutFactor, ReplaceRecoveryCodes, UpdateFactorStep
  • Mailer interface — methods Send
  • RuntimeConfig — fields AllowUnverifiedLogin, BaseURL, From, Issuer, MFAKeyEnv, MinPasswordLength
  • SQLStore — methods ByEmail, ByID, ClearFailures, ConsumeRecoveryCode, ConsumeToken, CountRecoveryCodes, Create, CreateToken, DeleteFactor, DeleteTokens, FailureCount, GetFactor, PurgeExpired, PutFactor, RecordFailure, ReplaceRecoveryCodes, Update, UpdateFactorStep
  • SQLStoreConfig — fields Flavor, TablePrefix
  • Service — methods BeginTOTPEnrolment, ChangePassword, CompleteSecondFactor, ConfirmTOTPEnrolment, ConsumeMagicLink, DisableTOTP, HasConfirmedFactor, Login, LoginFrom, Logout, MarkAuthenticated, RegenerateRecoveryCodes, Register, RemainingRecoveryCodes, RequestMagicLink, RequestPasswordReset, RequireFreshAuth, ResetPassword, RevokeSessions, StartPendingSession, StartSession, UseSessions, VerifyEmail, VerifySecondFactor
  • Store interface — methods ByEmail, ByID, ClearFailures, ConsumeToken, Create, CreateToken, DeleteTokens, FailureCount, RecordFailure, Update
  • Token — fields AccountID, CreatedAt, ExpiresAt, Hash, Purpose, UsedAt
  • TokenPurpose

Functions — ClientIP, DefaultConfig, FromRuntime, Module, New, NewSQLStore, NewTOTPSecret, TOTPURI, TestingTOTPCode, VerifyTOTP

Constants — FactorTOTP, FlavorMySQL, FlavorPostgres, FlavorSQLite, PurposeMagicLink, PurposeResetPassword, PurposeVerifyEmail, ReauthWindow, RecoveryCodeCount, RouteLogin, RouteLogout, RouteMFAVerify, RouteMagicLink, RoutePasswordChange, RoutePasswordReset, RouteRecoveryCodes, RouteRegister, RouteTOTP, RouteVerifyEmail, RuntimeModuleName, SessionKeyAccountID, SessionKeyAuthenticatedAt, SessionKeyEmail, SessionKeyPendingAccountID

Variables — ErrAccountDisabled, ErrAccountLocked, ErrEmailNotVerified, ErrEmailTaken, ErrInvalidCode, ErrInvalidCredentials, ErrInvalidToken, ErrMFANotEnrolled, ErrMFARequired, ErrMFAUnavailable, ErrNotFound, ErrReauthenticationRequired, ErrWeakPassword

pkg/app​

github.com/jcsvwinston/nucleus/pkg/app · 311 symbols · pkg.go.dev

Types

  • App — fields AuthChain, AuthFederated, Authorizer, Cache, Config, DB, DBs, I18n, JWT, Logger, Mailer, Models, Observability, Outbox, Realtime, Router, Session, SessionRecorder, Storage, Templates; methods AutoMigrate, Database, DatabaseForRequest, DefaultDB, DefaultDatabaseAlias, ErrorEnvelope, MountOpenAPIHandler, OnShutdown, OpenAuthz, ProblemDetails, RegisterHealthProbe, RegisterModel, Run, Shutdown, StartOutbox
  • AzureStorageSpec — fields AccountKey, AccountName, Container, PublicContainer
  • BridgeConfig — fields Config, Name, Type
  • CacheConfig — fields Prefix, Provider, RedisURL, Table
  • CircuitBreakerSpec — fields Cooldown, Enabled, FailureThreshold, HalfOpenMaxConcurrent
  • CleanupStorageSpec — fields Enabled, Interval, MaxAge, Prefix
  • Config — fields AuthBackendConfig, AuthBackends, AuthFederated, CORSAllowCredentials, CORSOrigins, CSRFEnabled, CSRFExemptPaths, CSRFInsecureCookie, Cache, DatabaseDefault, Databases, Debug, DefaultLocale, Env, HTTPInterceptors, Host, IdleTimeout, InterceptorConfig, JWTAudience, JWTCurrentKID, JWTExpiry, JWTIssuer, JWTKeys, JWTRevocation, JWTSecret, JobsConcurrency, JobsProvider, JobsQueues, JobsRedisURL, JobsRetention, JobsSchedulerLock, JobsTable, LocalesPath, LogFormat, LogLevel, LogRedactExtraKeys, MailCircuitBreaker, MailDeclared, MailDriver, MailFrom, MetricsPath, MetricsPublic, MultiSite, MultiTenant, OTLPEndpoint, Outbox, Plugins, Port, Profile, ProfilingEnabled, PublicBaseURL, RBACPolicyFile, RateLimitBurst, RateLimitByRole, RateLimitByRoute, RateLimitRequests, RateLimitWindow, ReadTimeout, RedisURL, RequestTimeout, SMTPHost, SMTPPass, SMTPPort, SMTPUser, SQLDriverInstrumentation, SessionCookieDomain, SessionCookieName, SessionCookiePath, SessionCookieSameSite, SessionCookieSecure, SessionIdleTimeout, SessionLifetime, SessionMemcachedServers, SessionRedisPrefix, SessionRedisURL, SessionStore, SessionTable, StateDir, StaticPrefix, StaticRoot, Storage, StorageDeclared, StorageProviderConfig, TLSCertFile, TLSKeyFile, TemplatesDir, TimeoutExemptPaths, TrustedProxies, WebhooksPrefix, WriteTimeout; methods Addr, DatabaseAliases, DatabaseByAlias, DeclaredProviders, DefaultDatabase, DefaultDatabaseAlias, IsDev, IsProd, ToStorageConfig
  • DatabaseConfig — fields Driver, MaxIdle, MaxLifetime, MaxOpen, URL
  • Extension interface — methods Attach, Name, Shutdown
  • GCSStorageSpec — fields Bucket, CredentialsSource, PublicBucket
  • HealthzCheck — fields LatencyMS, Message, Name, Status
  • HealthzResponse — fields CheckedAt, Checks, Status
  • JWTKeySpec — fields Algorithm, KID, PemEnv, PemPath, SecretEnv
  • LivenessResponse — fields Status, UptimeSeconds
  • LocalStorageSpec — fields Path
  • MultiSiteConfig — fields DefaultSite, Enabled, Sites
  • MultiTenantConfig — fields DatabaseAliasTemplate, DefaultTenant, Enabled, Header, RequireIsolatedDB, RequireTenantStorage, Resolver, Tenants
  • OpError — fields Err, Op; methods Error, Unwrap
  • Option
  • OutboxConfig — fields Bridges, Enabled, LeaseDuration, LeaseOwner, MaxRetries, MissingRoutePolicy, RetryBackoff, TableName
  • PluginAllowance — fields Capabilities, Provider
  • PluginsConfig — fields AllowExternal, Allowed, Commands; methods Policy
  • ReadinessResponse — fields CheckedAt, Checks, Reason, Status
  • RequestScope — fields DatabaseAlias, Host, Site, Tenant
  • S3StorageSpec — fields AccessKeyID, Bucket, CreateBucketIfMissing, Endpoint, PublicBucket, Region, SecretAccessKey, SessionToken, UsePathStyle
  • SiteConfig — fields Database, Hosts, TenantDatabaseAliasTemplate
  • StorageConfig — fields Azure, CircuitBreaker, Cleanup, DefaultVisibility, GCS, Local, Provider, PublicPaths, PublicURLBase, S3
  • TenantConfig — fields Database, Site

Functions — ApplyProfile, BeginDraining, Bootstrap, ContractConfigKeyPatterns, DatabaseAliasFromContext, DefaultConfig, Draining, LoadConfig, New, NormalizeRuntimeConfig, QuickStart, RealtimeChannelPath, RequestScopeFromContext, SiteFromContext, TenantFromContext, ValidateReferential, ValidateSemantics, WithAPIKeys, WithAuthz, WithErrorEnvelope, WithExtensions, WithMail, WithOpenAuthz, WithProblemDetails, WithRateLimit, WithRealtime, WithStorage, WithTemplateFuncs, WithTemplates, WithTemplatesFS, WithUserProvider, WithUserProviderNamed, WithoutDefaults

Constants — RealtimeRoute

Variables — ErrDatabaseAliasNotFound, ErrInvalidConfigReference, ErrInvalidConfigValue, ErrModelsRegistryNotInitialized, ErrNilApp, ErrNilConfig, ErrNotInitialized, ErrServerAlreadyRunning, ErrTenantIsolationViolation

pkg/auth​

github.com/jcsvwinston/nucleus/pkg/auth · 229 symbols · pkg.go.dev

Types

  • Backend
  • BackendConfig
  • BackendFactory
  • Chain — methods Authenticate, Names
  • ChainConfig — fields Backends, ProviderConfig
  • Claims — fields Role, Roles, UserID, Username; methods AllRoles, HasRole
  • FederatedConfig — fields CallbackBase, Instances, PendingTTL, ProviderConfig
  • FederatedInstance — fields DisplayName, Name, Provider
  • FederatedSet — methods Begin, CallbackIsCrossSiteFormPost, CallbackURL, Complete, Instances, Names, PendingCount, PublishesServiceMetadata, ServiceMetadata
  • JWK — fields Alg, Crv, E, Kid, Kty, N, Use, X, Y
  • JWKSet — fields Keys
  • JWTManager — methods Audience, CurrentKID, Generate, GenerateWithRoles, JWKS, JWKSHandler, Middleware, OptionalJWTMiddleware, RemoveKey, Revoke, RotateKey, SetAudience, SetRevocationStore, Validate, ValidateContext
  • MemcachedSessionStore — methods All, AllCtx, Commit, CommitCtx, Delete, DeleteCtx, Find, FindCtx
  • MemoryRevocationStore — methods Len, Revoke, Revoked
  • RedisSessionStore — methods All, AllCtx, Commit, CommitCtx, Delete, DeleteCtx, Find, FindCtx
  • RevocationStore interface — methods Revoke, Revoked
  • SQLSessionStore — methods All, AllCtx, Commit, CommitCtx, Delete, DeleteCtx, Find, FindCtx
  • SQLSessionStoreConfig — fields DatabaseURL, TableName
  • SessionCache — methods Flush, Forget, Get, GetBool, GetInt, Has, Put, PutBool, PutInt, Remember, RememberBool, RememberInt
  • SessionConfig — fields CookieName, Domain, IdleTimeout, Lifetime, Path, SameSite, Secure
  • SessionInfo — fields Deadline, Token, Values
  • SessionManager — methods ActiveSessions, Destroy, Exists, Flash, FlashBool, FlashInt, Forget, GetBool, GetFlash, GetFlashBool, GetFlashInt, GetInt, GetString, HasSession, Invalidate, Keep, Middleware, Now, Pull, PullBool, PullInt, Put, PutBool, PutInt, Reflash, Remove, RenewToken, Revoke, RevokeWhere, SCS, SessionStore, SetSessionStore, SetStore, Token
  • SessionRuntimeIdentity — fields Host, Instance, Pod
  • SessionStore
  • SessionStoreFactory
  • SessionStoreParams
  • SigningAlgorithm
  • SigningKey — fields Algorithm, ECDSAPrivate, HMACSecret, KID, RSAPrivate
  • User
  • UserProvider interface — methods FindByEmail, FindByID, FindByUsername, ValidateCredentials

Functions — BuildSessionStore, CheckPassword, ClaimsFromContext, ClientIPFromRequest, ContextWithClaims, DetectSessionRuntimeIdentity, FederatedCallbackPath, FederatedMetadataPath, FederatedStartPath, HashPassword, NewChain, NewChainFrom, NewFederatedSet, NewJWTManager, NewJWTManagerFromKeys, NewJWTManagerFromSecret, NewMemcachedSessionStore, NewMemcachedSessionStoreFromServers, NewMemoryRevocationStore, NewRedisSessionStore, NewRedisSessionStoreFromURL, NewSQLSessionStore, NewSessionCache, NewSessionManager, NewSessionStoreRevocations, NewUserProviderBackend, RegisterBackend, RegisterSessionStore, RegisteredBackends, RegisteredSessionStores, RuntimeMetadataMiddleware

Constants — DefaultFederatedPendingTTL, ES256, HS256, RS256, SessionKeySubject, SessionMetaFirstSeenAtKey, SessionMetaHostKey, SessionMetaInstanceKey, SessionMetaLastSeenAtKey, SessionMetaPodKey, SessionMetaRemoteIPKey, SessionMetaUserAgentKey

Variables — ErrBackendUnavailable, ErrInvalidCredentials, ErrNilSessionManager, ErrSessionStoreNotIterable, ErrTokenRevoked, ErrUserNotFound

pkg/auth/apikeys​

github.com/jcsvwinston/nucleus/pkg/auth/apikeys · 45 symbols · pkg.go.dev

Types

  • Flavor
  • Key — fields CreatedAt, ExpiresAt, ID, LastUsedAt, Name, OwnerID, RevokedAt, RotatedFrom, Scopes, SecretHash; methods Active, HasScope
  • SQLStore — methods ByID, Create, List, Revoke, TouchLastUsed
  • SQLStoreConfig — fields Flavor, Table
  • Store interface — methods ByID, Create, List, Revoke, TouchLastUsed

Functions — Authenticate, FromContext, Issue, Middleware, NewSQLStore, Require, Rotate, ScopeSubject

Constants — FlavorMySQL, FlavorPostgres, FlavorSQLite, HeaderName, Prefix, ScopeSubjectPrefix

Variables — ErrInvalidKey, ErrNotFound

pkg/auth/backend​

github.com/jcsvwinston/nucleus/pkg/auth/backend · 24 symbols · pkg.go.dev

Types

  • Backend interface — methods Authenticate, Name
  • Config — fields Name, ProviderConfig; methods Bind
  • Factory
  • User — fields Email, ID, IsSuperuser, Role, Roles, Username; methods AllRoles, HasRole

Functions — Lookup, Register, Registered, Unregister

Variables — ErrBackendUnavailable, ErrInvalidCredentials, ErrUserNotFound

pkg/auth/backend/backendtest​

github.com/jcsvwinston/nucleus/pkg/auth/backend/backendtest · 7 symbols · pkg.go.dev

Types

  • Suite — fields New, Unavailable, UnknownUser, ValidPassword, ValidUser

Functions — Run

pkg/auth/federated​

github.com/jcsvwinston/nucleus/pkg/auth/federated · 27 symbols · pkg.go.dev

Types

  • BeginRequest — fields CallbackURL, Nonce
  • CompleteRequest — fields Form, Nonce, Query, State
  • CrossSiteFormPostCallback interface — methods CallbackIsCrossSiteFormPost
  • Factory
  • Provider interface — methods Begin, Complete, Name
  • Redirect — fields State, URL
  • ServiceMetadataPublisher interface — methods ServiceMetadata
  • User

Functions — Lookup, Register, Registered, Unregister

Variables — ErrIdentityRejected, ErrProviderUnavailable

pkg/auth/federated/oidc​

github.com/jcsvwinston/nucleus/pkg/auth/federated/oidc · 15 symbols · pkg.go.dev

Types

  • Config — fields ClientID, ClientSecret, Issuer, RoleClaim, Scopes, SkipIssuerVerification, Timeout, UsernameClaim
  • Provider — methods Begin, Complete, Name

Functions — New

Constants — ProviderName

pkg/auth/sessionstore​

github.com/jcsvwinston/nucleus/pkg/auth/sessionstore · 16 symbols · pkg.go.dev

Types

  • Factory
  • Params — fields DB, DatabaseURL, KeyPrefix, MemcachedServers, RedisURL, TableName
  • Store interface — methods Commit, Delete, Find

Functions — Lookup, Register, Registered, Unregister

pkg/authz​

github.com/jcsvwinston/nucleus/pkg/authz · 57 symbols · pkg.go.dev

Types

  • ActionResolver
  • AuthzOptions — fields OnDeny, ResolveAction, ResolveSubject
  • CSVMigrationReport — fields BlankOrCommentLines, Changed, GroupingLinesPreserved, Path, PolicyLinesAlreadyMigrated, PolicyLinesUpgraded
  • Denial — fields Authenticated, Reason, Status
  • DenialHandler
  • Enforcer — methods AddPolicy, AddRole, AllowAll, AllowResource, Can, Deny, GetAllRoles, GetGroupingPolicy, GetPolicy, GetRoles, Middleware, MiddlewareWithOptions, RemovePolicy, RemoveRole, RequireRole, RequireRoleWithOptions, SeedBootstrapAllowList, SeedBootstrapAllowListExcluding, SetupAdminPolicies, SetupModelPolicies
  • ObjectEnforcer — methods AddRole, Allow, Can, Deny, Policies
  • SubjectResolver

Functions — ActionForMethod, BootstrapAllowList, ContextWithEnforcer, ContextWithObjectEnforcer, EnforcerFromContext, MigrateCSVPolicyFile, New, NewFromModel, NewObjectEnforcer, ObjectEnforcerFromContext, ObjectMiddleware

Constants — BootstrapSubject

pkg/circuit​

github.com/jcsvwinston/nucleus/pkg/circuit · 17 symbols · pkg.go.dev

Types

  • Breaker — methods Do, Opens, State
  • Config — fields Cooldown, FailureThreshold, HalfOpenMaxConcurrent, Now, OnStateChange
  • State — methods String

Functions — New

Constants — StateClosed, StateHalfOpen, StateOpen

Variables — ErrOpen

pkg/db​

github.com/jcsvwinston/nucleus/pkg/db · 87 symbols · pkg.go.dev

Types

  • AppliedMigration — fields AppliedAt, ID, Namespace
  • Config — fields DatabaseMaxIdle, DatabaseMaxLifetime, DatabaseMaxOpen, DatabaseURL, DriverName, Engine, StatementObserver
  • DB — methods AutoMigrate, Close, Engine, Health, SqlDB, System, Tx
  • DriftEntry — fields ActualChecksum, AppliedAt, ExpectedChecksum, ID, Kind
  • Engine
  • ExpectedColumn — fields Name, Nullable
  • ExpectedTable — fields Columns, Name
  • MigrationStatus — fields Applied, AppliedAt, HasDown, HasUp, ID
  • Migrator — methods Applied, Create, Down, Drift, SchemaDrift, Status, Steps, Up
  • MigratorConfig — fields DB, Dir, FS, Module
  • SchemaDriftEntry — fields Actual, Column, Expected, Kind, Table
  • StatementInfo — fields Args, Duration, Err, Operation, Query, RowsAffected
  • StatementObserver

Functions — ExecScript, IsUniqueViolation, New, NewMigrator, NewMigratorFromConfig, NewModuleFSMigrator, NewModuleMigrator, ResolveDriver, SystemFromURL

Constants — DriftKindChecksumMismatch, DriftKindMissingUpFile, DriftKindSchemaColumnNullability, DriftKindSchemaExtraColumn, DriftKindSchemaMissingColumn, DriftKindSchemaMissingTable, EngineSQL

Variables — ErrAutoMigrate, ErrSQLRequired, ErrSchemaDriftUnsupported, ErrUnsupportedEngine

pkg/db/driver​

github.com/jcsvwinston/nucleus/pkg/db/driver · 6 symbols · pkg.go.dev

Types

  • UniqueViolationFunc

Functions — HasEngine, MustRegisterUniqueViolation, RegisterUniqueViolation, RegisteredEngines, UniqueViolationFuncs

pkg/db/driver/drivertest​

github.com/jcsvwinston/nucleus/pkg/db/driver/drivertest · 6 symbols · pkg.go.dev

Types

  • Case — fields Classify, Engine, NotViolation, Violation

Functions — VerifyClassifier

pkg/errors​

github.com/jcsvwinston/nucleus/pkg/errors · 58 symbols · pkg.go.dev

Types

  • ContextProvider interface — methods Context
  • DomainError — fields Code, Details, Message, StatusCode; methods Context, Error, LogLevel, Render, Report, WithDetails
  • ErrorBody — fields Code, Details, Message
  • ErrorHandler — methods Render, Report
  • ErrorHandlerConfig — fields GlobalContext, IgnoredErrors, LogLevelMap, ThrottleConfig
  • ErrorResponse — fields Error
  • LogLevelProvider interface — methods LogLevel
  • Problem — fields Code, Detail, Details, Instance, Status, Title, Type
  • Renderable interface — methods Render
  • Reportable interface — methods Report
  • ThrottleConfig — fields Duration, KeyFunc, RateLimit, SampleRate

Functions — BadRequest, Conflict, Forbidden, InternalError, NewErrorHandler, NewProblem, NotFound, Unauthorized, ValidationFailed, WriteError, WriteProblem

Constants — ProblemContentType

pkg/health​

github.com/jcsvwinston/nucleus/pkg/health · 17 symbols · pkg.go.dev

Types

  • DBHealther interface — methods Health
  • Prober interface — methods Name, Probe
  • Result — fields Healthy, LatencyMS, Message, Name

Functions — FuncProbe, NewDBProbe, NewMailProbe, NewRedisProbe, NewStorageProbe, Run, SupportsMailProbe

pkg/mail​

github.com/jcsvwinston/nucleus/pkg/mail · 60 symbols · pkg.go.dev

Types

  • Attachment — fields Content, ContentID, ContentType, Filename, Inline
  • CircuitBreakerConfig — fields Cooldown, Enabled, FailureThreshold, HalfOpenMaxConcurrent
  • Config — fields CircuitBreaker, Driver, Logger, Plugins, SMTPHost, SMTPPass, SMTPPort, SMTPUser, Timeout
  • HealthChecker interface — methods Healthy
  • MemorySender — methods Health, Reset, Send, Sent
  • Message — fields Attachments, Body, From, HTML, Headers, Subject, To
  • OutboxBridge — methods Close, Healthy, Name, Send
  • ProviderFactory
  • Sender interface — methods Send
  • Templates — methods Names, Render

Functions — Discards, Enqueue, EnqueueTx, NewMemorySender, NewOutboxBridge, NewSender, ParseFS, RegisterProvider, RegisteredProviders, SetPluginHost

Constants — LogDriver, NoopDriver, OutboxTopic

pkg/model​

github.com/jcsvwinston/nucleus/pkg/model · 168 symbols · pkg.go.dev

Types

  • BaseModel — fields CreatedAt, DeletedAt, ID, UpdatedAt
  • CRUD — methods Create, Delete, FindAll, FindByID, SetDialect, SetSQLQueryObserver, Update
  • CRUDOperator interface — methods Create, Delete, FindAll, FindByID, Update
  • Choice — fields Label, Value
  • FieldMeta — fields Choices, Column, ForeignColumn, ForeignModel, ForeignTable, GoType, HTMLType, IndexRefs, IsExcluded, IsFilter, IsForeignKey, IsList, IsPK, IsReadOnly, IsRequired, IsSearch, IsTenantField, Label, MaxLength, Name, UnknownDBTokens
  • FieldMetaUpdate — fields HTMLType, IsExcluded, IsFilter, IsList, IsReadOnly, IsSearch, Label
  • Filter — fields Column, Op, Value, Values
  • FilterOp
  • ForeignKey — fields Column, FieldName, ForeignColumn, ForeignModel, ForeignTable
  • HookContext — fields Context, DB, Engine, Tx
  • HookFunc
  • IndexMeta — fields Columns, Name, Unique
  • IndexRef — fields Name, Unique
  • ModelConfig — fields AfterCreate, AfterUpdate, BeforeCreate, BeforeDelete, BeforeUpdate, DatabaseAlias, ExcludeFields, FieldLabels, Filters, Icon, ListFields, OrderBy, PageSize, ReadOnly, RejectClientPK, SearchFields
  • ModelMeta — fields Config, DatabaseAlias, Fields, ForeignKeys, Indexes, Name, Plural, PrimaryKey, Table, Type; methods TenantFieldName
  • PaginatedResult — fields HasMore, IsEstimated, Items, Page, PageSize, Total, TotalPages
  • QueryOpts — fields ExactTotal, Fields, Filters, OrderBy, Page, PageSize, Search, Where
  • Registry — methods All, BulkUpdateFieldMeta, Count, Get, Register, UpdateFieldMeta
  • SQLQueryEvent — fields Args, Duration, Error, ModelName, Operation, Query, RowsAffected
  • SQLQueryObserver

Functions — BuildMSSQLMigrationScaffold, BuildMigrationScaffoldForSystem, BuildMySQLMigrationScaffold, BuildOracleMigrationScaffold, BuildPostgresMigrationScaffold, BuildSQLiteMigrationScaffold, ExtractMeta, NewCRUD, NewRegistry, ParseFilterOp, ResetDefaultSQLObservers, SanitizeOrderBy, SetDefaultSQLObserver

Constants — HookEngineSQL, OpContains, OpEndsWith, OpEqual, OpGreater, OpGreaterEqual, OpIn, OpIsNull, OpLess, OpLessEqual, OpNotEqual, OpNotIn, OpStartsWith

Variables — ErrClientAssignedPK, ErrDuplicateModelName, ErrNoPrimaryKey

pkg/nucleus​

github.com/jcsvwinston/nucleus/pkg/nucleus · 312 symbols · pkg.go.dev

Types

  • APIDocumentSpec — fields Base, Pattern, ValidateRequests
  • APIVersion
  • App — fields APIDocument, Lifecycle, Middleware, Modules, OpenAPI, Options, Services
  • AppBuilder — methods Build, Err, FromConfigFile, Mount, Serve, Start, Use, WithAPIKeys, WithAuthz, WithConfigStrict, WithDatabases, WithErrorEnvelope, WithExtensions, WithMail, WithOpenAPIDocument, WithOpenAPIHandler, WithOpenAPIValidation, WithOpenAuthz, WithProblemDetails, WithRateLimit, WithRealtime, WithStorage, WithTemplateFuncs, WithTemplates, WithTemplatesFS, WithUnknownFields, WithUserProvider, WithUserProviderNamed, WithoutDefaults
  • CacheSource interface — methods Cache
  • ConfigSource — fields Kind, Line, Path
  • Context — methods BindForm, BindHeaders, BindJSON, BindPath, BindQuery, BindRequest, BindXML, Can, CanObject, Claims, Get, HTML, HasRole, JSON, Negotiate, NoContent, Param, Query, RawHTML, Redirect, Render, RequestID, SessionGetString, SessionPutString, Set, Status, String, UserID, XML
  • Creator interface — methods Create
  • Destroyer interface — methods Destroy
  • EffectiveConfig — fields Values
  • EffectiveValue — fields Key, Redacted, Source, Value
  • EndpointOption
  • EventBus interface — methods EmitSQL, SubscribeHTTP, SubscribeSQL
  • Extension
  • FederatedSignInConfig — fields Redirect
  • HTTPEvent — fields Duration, EmittedAt, Method, NodeID, Path, PayloadPreview, RemoteIP, RequestID, Status, TraceID, UserAgent, UserID
  • Handler
  • Indexer interface — methods Index
  • JobRegistry interface — methods Register
  • JobSpec — fields Cron, Every, Handler, Singleton, Timeout
  • Key — methods FromContext, String, WithValue
  • LifecycleHooks — fields OnShutdown, OnStart
  • MethodSet — methods Has
  • Middleware
  • Module — fields CSRFExempt, Config, DefaultDB, DependsOn, Jobs, Middleware, Migrations, Models, Name, OnShutdown, OnStart, Policies, Prefix, Requires, Routes, Templates, Version, Webhooks; methods Build
  • ModuleCheck — fields Err, Name
  • ModuleSpec interface — methods Config, DefaultDB, Jobs, Middleware, Migrations, Models, Name, OnShutdown, OnStart, Prefix, Requires, Routes, Webhooks
  • OpenAPISpec — fields Handler, Pattern
  • Option
  • Patcher interface — methods Patch
  • PolicyRule — fields Action, Effect, Object, Subject
  • RealtimeSource interface — methods Realtime
  • ResourceMethod
  • Router interface — methods Delete, Get, Group, Mount, Patch, Post, Put, Resource, With
  • Runtime interface — methods ApplyModuleMigrations, AuthChain, Authorizer, AutoMigrate, DB, DBForRequest, DatabaseHandle, DatabaseHandles, Databases, JWT, Logger, Mailer, Models, Observability, Outbox, Session, Storage, Tasks
  • SQLEvent — fields Args, Duration, EmittedAt, Err, ModelName, NodeID, Operation, Query, RequestID, RowsAffected, TraceID, UserID
  • ServiceRegistration — fields Health, Name, Run
  • Shower interface — methods Show
  • TaskInspectorSource interface — methods TaskInspector
  • Updater interface — methods Update
  • WebhookRegistry interface — methods Register
  • WebhookSpec — fields Handler, MaxBytes, Methods, Secret, TimestampTolerance

Functions — CacheFrom, CheckModule, Description, FederatedSignIn, Handle, LoadEffective, Methods, New, NewKey, Provide, RealtimeFrom, Resolve, Run, RunContext, SetValue, SignWebhookBody, SignWebhookBodyWithTimestamp, Status, Summary, TaskInspectorFrom, Timeout, Value, Versioned, WithAPIKeys, WithAuthz, WithErrorEnvelope, WithExtensions, WithMail, WithOpenAuthz, WithProblemDetails, WithRateLimit, WithRealtime, WithStorage, WithTemplateFuncs, WithTemplates, WithTemplatesFS, WithoutDefaults

Constants — Create, Destroy, EnvProduction, FederatedSignInModuleName, Index, MaxConfigFileBytes, Patch, SessionKeyFederatedEmail, SessionKeyFederatedInstance, SessionKeyFederatedUserID, SessionKeyFederatedUsername, Show, UnknownFieldsStrict, UnknownFieldsWarn, Update, WebhookSignatureHeader, WebhookTimestampHeader

Variables — ErrAlreadyProvided, ErrConfigFileTooLarge, ErrInvalidConfigReference, ErrInvalidConfigValue, ErrInvalidJobSpec, ErrInvalidModuleConfig, ErrInvalidModulePolicy, ErrInvalidUnknownFieldsMode, ErrInvalidWebhookSpec, ErrMixedConfigFormats, ErrModuleDependency, ErrNotProvided, ErrSecurityKeyNotNullable, ErrUnknownConfigKeys, ErrUnsupportedConfigFormat

pkg/observability​

github.com/jcsvwinston/nucleus/pkg/observability · 102 symbols · pkg.go.dev

Types

  • Bus — methods Emit, HasSubscribers, Stats, Subscribe, SubscriberCount
  • CustomEvent — fields ContentType, Labels, Name, Payload; methods EmittedAt, Kind, NodeID, Release
  • Event interface — methods EmittedAt, Kind, NodeID, Release
  • EventKind — methods String
  • Filter — fields Kinds, NodeIDs; methods Matches
  • HTTPRequestEvent — fields Duration, Method, Path, PayloadPreview, RemoteIP, RequestID, Status, TraceID, UserAgent, UserID; methods EmittedAt, Kind, NodeID, Release
  • RingBuffer — methods Capacity, Dropped, Len, Push, Snapshot
  • SQLStatementEvent — fields Args, Duration, Err, ModelName, Operation, Query, RequestID, RowsAffected, TraceID, UserID; methods EmittedAt, Kind, NodeID, Release
  • SessionChangeEvent — fields Change, IP, LastRoute, TokenShort, TraceID, UserAgent, UserID; methods EmittedAt, Kind, NodeID, Release
  • SessionChangeKind — methods String
  • Stats — fields Dropped, Emitted, Subscribers
  • SubscribeOptions — fields ChannelSize
  • Subscription — methods Cancel, Ch, Filter

Functions — AcquireCustomEvent, AcquireHTTPRequestEvent, AcquireSQLStatementEvent, AcquireSessionChangeEvent, NewBus, NewRingBuffer

Constants — DefaultSubscriberChannelSize, KindCustom, KindHTTPRequest, KindSQLStatement, KindSessionChange, KindUnknown, SessionChangeCreated, SessionChangeDestroyed, SessionChangeTouched, SessionChangeUnspecified

pkg/observability/hooks​

github.com/jcsvwinston/nucleus/pkg/observability/hooks · 27 symbols · pkg.go.dev

Types

  • HTTPMiddlewareConfig — fields Bus, ExcludePaths, MaxPathBytes, MaxPayloadPreviewBytes, MaxUserAgentBytes, NodeID
  • SQLObserverConfig — fields Bus, NodeID
  • SessionInfo — fields IP, LastRoute, TokenShort, TraceID, UserAgent, UserID
  • SessionRecorder — methods Created, Destroyed, Touched
  • SessionRecorderConfig — fields Bus, NodeID

Functions — NewHTTPMiddleware, NewSQLObserver, NewSessionRecorder

pkg/observe​

github.com/jcsvwinston/nucleus/pkg/observe · 25 symbols · pkg.go.dev

Types

  • RedactionConfig — fields Disabled, ExtraKeys, Placeholder
  • TelemetryConfig — fields OTLPEndpoint, PrometheusEnabled, PrometheusRequested, ServiceName

Functions — CtxWithModelObserved, CtxWithRequestID, CtxWithTenantID, CtxWithTraceID, CtxWithUserID, DefaultRedactedKeys, IsModelObserved, NewLogger, NewLoggerWithRedaction, RequestIDFromCtx, SetupOpenTelemetry, TenantIDFromCtx, TraceIDFromCtx, UserIDFromCtx, WithContext

Constants — RedactionPlaceholder

pkg/observe/exporter​

github.com/jcsvwinston/nucleus/pkg/observe/exporter · 14 symbols · pkg.go.dev

Types

  • Config — fields Endpoint, Insecure, ServiceName
  • Exporter — fields Handler, Reader, Shutdown, Spans
  • Factory

Functions — Lookup, MustRegister, Register, Registered

pkg/plugins​

github.com/jcsvwinston/nucleus/pkg/plugins · 131 symbols · pkg.go.dev

Types

  • Allowance — fields Capabilities, Provider
  • Descriptor — fields BinaryPath, Capabilities, ProbeError, Provider, Refused, Source
  • ExecutionError — fields Cause, Code, ExitCode, Message, Retriable, Stderr; methods Error, Unwrap
  • Failure — fields Code, ExitCode, Message, Retriable; methods Error
  • Host interface — methods CollectInventory, ExecuteRequest, ProbeCapabilities
  • LocalHost — methods CollectInventory, ExecuteRequest, ProbeCapabilities
  • MailSendOutput — fields Accepted, ProviderRequestID
  • MailSendPayload — fields Body, From, Headers, Subject, To
  • Plugin — fields Custom, MailSend, QueuePublish, WebhookDeliver
  • Policy — fields Allowed, Commands, DenyExternal; methods AllowCommand, AllowPlugin, ListsCommands, ListsPlugins, String
  • QueuePublishOutput — fields Accepted, MessageID
  • QueuePublishPayload — fields Body, Headers, Key, Topic
  • RefusedError — fields Capability, Key, Kind, Name; methods Error
  • RequestEnvelope — fields Capability, Metadata, Payload, Provider, RequestID, TimeoutMS, Timestamp, Version
  • ResponseEnvelope — fields Error, Metrics, OK, Output, ProviderRequestID, RequestID, Retriable, Version
  • ResponseError — fields Code, Message
  • ResponseMetrics — fields DurationMS
  • Source
  • WebhookDeliverOutput — fields Accepted, StatusCode
  • WebhookDeliverPayload — fields Body, Headers, Method, TimeoutMS, URL

Functions — BuiltinMailDescriptorsFromProviders, CollectInventory, DecodeMailSendOutput, DiscoverAllowed, DiscoverExternal, ExecuteRequest, Fail, IsExecutableFile, NewRequestEnvelope, ParseProviderFromBinary, ProbeCapabilities, Serve, ServeIO, SupportsCapability

Constants — CapabilityMailSend, CapabilityQueuePublish, CapabilityWebhookDeliver, DefaultProbeTimeout, EnvelopeVersionV1, ExitCodeInternal, ExitCodeRejected, ExitCodeSuccess, ExitCodeTimeout, ExitCodeTransient, ExitCodeValidation, GenericBinaryPrefix, SourceBuiltinMail, SourceExternalGeneric

pkg/router​

github.com/jcsvwinston/nucleus/pkg/router · 193 symbols · pkg.go.dev

Types

  • APIVersion — fields Deprecated, Name, Policy, Successor, Sunset; methods Headers, Path, Validate
  • CORSOptions — fields AllowCredentials, AllowedHeaders, AllowedMethods, AllowedOrigins, ExposedHeaders, MaxAge
  • CSRFOptions — fields AllowSameSite, CookieName, EnableOriginCheck, EnableXSRFCookie, EncryptionKey, ExemptPaths, FormField, HeaderName, InsecureCookie, Logger, OriginOnly, RotateToken, SessionKey, UseSessionToken, XSRFCookieName
  • Context — fields Request, Writer; methods Bind, BindData, Data, Download, File, Form, HTML, JSON, Next, NoContent, Param, Query, Redirect, SessionDestroy, SessionGetBool, SessionGetInt, SessionGetString, SessionManager, SessionPutBool, SessionPutInt, SessionPutString, SessionRemove, SessionRenewToken, Set, T, Value, XML
  • ContextHandlerFunc
  • ContextOption
  • HTTPError — fields Code, Message; methods Error
  • Handler
  • Middleware
  • Mux — methods Delete, Get, Group, Handle, HandleFunc, Mount, Patch, Post, Put, Resource, Route, ServeHTTP, SetHTMLTemplates, SetSessionManager, Static, Use, Version, Walk, With
  • Option
  • RateLimitOptions — fields Burst, KeyFunc, Requests, RoleDimension, RouteDimension, ScopeByRole, ScopeByRoute, Window
  • RateLimitPolicy — fields Burst, ByRole, ByRoute, Requests, Window
  • ResourceHandlers — fields Create, Delete, List, Retrieve, Update
  • RouteEntry — fields Method, Middlewares, Pattern
  • Router
  • WrapResponseWriter — methods BytesWritten, Flush, Hijack, Status, Unwrap, Write, WriteHeader, WroteHeader

Functions — Bind, BindForm, BindHeaders, BindMax, BindPath, BindQuery, BindRequest, CORSMiddleware, CSRFMiddleware, CSRFToken, Compress, ContextHandler, Created, DefaultStack, Error, FromHTTP, FromHandler, GetReqID, IsWebSocketUpgrade, JSON, Matched, Negotiate, New, NewCSRFMiddleware, NewContext, NewHTTPError, NewMux, NewWrapResponseWriter, NoContent, Paginate, RateLimitFromPolicy, RateLimitMiddleware, RealIP, Recoverer, RecovererWithLogger, RequestID, RequestLogger, RouteFromContext, SecurityHeaders, TelemetryMiddleware, Timeout, TimeoutMiddleware, TimeoutMiddlewareWithExemptions, WhenMatched, WithCORSCredentials, WithCORSOrigins, WithCSRF, WithCSRFInsecureCookie, WithDevelopmentErrors, WithHSTS, WithProblemDetails, WithRateLimit, WithRateLimitPolicy, WithSession, WithTemplates, WithTimeout, WithTimeoutExempt, WithTrustedProxies, Wrap

Variables — ErrCSRFEncryptionKey, ErrDownloadFilenameInvalid, ErrFilePathRequired, ErrNilContextRequest, ErrNilContextWriter, ErrSessionManagerNotSet, ErrTemplateEngineNotSet, ErrTemplateNameRequired

pkg/router/interceptor​

github.com/jcsvwinston/nucleus/pkg/router/interceptor · 13 symbols · pkg.go.dev

Types

  • Config — fields Name, ProviderConfig; methods Bind
  • ErrorReporter interface — methods ReportError
  • Factory
  • Interceptor

Functions — Build, Lookup, Register, Registered, Unregister

pkg/signals​

github.com/jcsvwinston/nucleus/pkg/signals · 45 symbols · pkg.go.dev

Types

  • Bus — methods Clear, Dropped, Emit, EmitAsync, On
  • Event — fields Ctx, ModelName, Payload, Signal
  • Handler
  • RedisRelay — methods Channel, Close, ForwardToBus, Publish, Subscribe
  • RedisRelayConfig — fields ChannelPrefix, RedisURL
  • Signal
  • Topic — methods Name, String

Functions — Define, NewBus, NewRedisRelay, Publish, PublishAsync, Subscribe

Constants — PostCreate, PostDelete, PostSave, PostUpdate, PreCreate, PreDelete, PreSave, PreUpdate

Variables — ErrHandlerPanic, ErrNilBus, ErrNilHandler, ErrNilRelay, ErrRedisURLRequired, ErrSignalRequired

pkg/storage​

github.com/jcsvwinston/nucleus/pkg/storage · 84 symbols · pkg.go.dev

Types

  • AzureConfig
  • CircuitBreakerConfig
  • Cleaner — methods Start, Stop
  • CleanupConfig
  • Config
  • CredentialSource
  • ErrInvalidKey
  • ErrNotFound
  • GCSConfig
  • ListOptions
  • ListResult
  • LocalConfig
  • LocalStore — methods Close, Copy, Delete, Exists, Get, List, PublicURL, Put, SignedURL
  • MemoryStore — methods Close, Copy, Delete, Exists, Get, List, PublicURL, Put, SignedURL
  • ObjectInfo
  • ProviderFactory
  • ProviderType
  • PublicMapper — methods IsPublicKey, Mount, MountAll, PublicURL
  • PutOptions
  • S3Config
  • Store
  • TenantKey
  • TenantStore — methods Close, Copy, Delete, Exists, Get, List, PublicURL, Put, SignedURL, Unwrap, UnwrapIfCleaner
  • TenantStoreOptions — fields Logger, Strict
  • URLConfig
  • Visibility

Functions — CleanupTempKey, DefaultConfig, IsTempKey, New, NewCleaner, NewLocalStore, NewMemoryStore, NewPublicMapper, NewPublicMapperForConfig, NewTenantStore, NewTenantStoreWithOptions, NewWithTenant, RegisterProvider, RegisteredProviders

Constants — Private, ProviderAzure, ProviderGCS, ProviderLocal, ProviderS3, Public

Variables — ErrNoTenantInContext

pkg/storage/provider​

github.com/jcsvwinston/nucleus/pkg/storage/provider · 109 symbols · pkg.go.dev

Types

  • AzureConfig — fields AccountKey, AccountName, Container, PublicContainer
  • CircuitBreakerConfig — fields Cooldown, Enabled, FailureThreshold, HalfOpenMaxConcurrent
  • CleanupConfig — fields Enabled, Interval, MaxAge, Prefix
  • Config — fields Azure, CircuitBreaker, Cleanup, DefaultVisibility, GCS, Local, Provider, ProviderConfig, PublicPaths, PublicURLBase, S3; methods BindProvider, Validate
  • CredentialSource — fields EnvVar, File, SecretManager, Value; methods Resolve
  • ErrInvalidKey — methods Error
  • ErrNotFound — methods Error
  • Factory
  • GCSConfig — fields Bucket, CredentialsSource, PublicBucket
  • ListOptions — fields Delimiter, Limit, Marker, Prefix
  • ListResult — fields CommonPrefixes, NextMarker, Objects, Truncated
  • LocalConfig — fields Path
  • ObjectInfo — fields ContentType, Key, Metadata, Size, UpdatedAt, Visibility
  • ProviderType
  • PutOptions — fields ContentType, Metadata, TenantPrefix, Visibility
  • S3Config — fields AccessKeyID, Bucket, CreateBucketIfMissing, Endpoint, PublicBucket, Region, SecretAccessKey, SessionToken, UsePathStyle
  • Store interface — methods Close, Copy, Delete, Exists, Get, List, PublicURL, Put, SignedURL
  • URLConfig — fields ContentType, Disposition, Expires
  • Visibility

Functions — DefaultConfig, EscapeURLPath, Lookup, NormalizeKey, Register, Registered, Unregister, ValidateKey, ValidateKeyPrefix

Constants — Private, ProviderAzure, ProviderGCS, ProviderLocal, ProviderS3, Public

pkg/tasks​

github.com/jcsvwinston/nucleus/pkg/tasks · 130 symbols · pkg.go.dev

Types

  • Config — fields Concurrency, Queues, RedisURL, StrictPriority
  • EnqueuePolicy — fields BackoffBase, BackoffMax, MaxRetry, ProcessIn, Queue, Retention, Timeout, UniqueKey
  • EnqueueRecord — fields EnqueuedAt, ID, Payload, Queue, Type
  • EnqueueRecorder interface — methods Enqueued, ResetEnqueued
  • HandlerFunc
  • Inspector interface — methods InspectRuntime, OperateQueue
  • Manager interface — methods Close, EnqueueJSON, EnqueueJSONCtx, EnqueueJSONCtxWithPolicy, EnqueueJSONWithPolicy, HandleFunc, Run
  • QueueActionResult — fields Action, Affected, Applied, Enabled, GeneratedAt, Message, Queue
  • RuntimeQueueSnapshot — fields Active, Aggregating, Archived, Completed, FailedAll, FailedToday, LatencyMS, Name, Paused, Pending, ProcessedAll, ProcessedToday, Retry, Scheduled, Size
  • RuntimeScheduleSnapshot — fields ID, NextEnqueueAt, PrevEnqueueAt, Spec, TaskType
  • RuntimeServerSnapshot — fields ActiveWorkers, Concurrency, Host, ID, PID, Queues, StartedAt, Status, StrictPriority
  • RuntimeSnapshot — fields Enabled, GeneratedAt, Queues, Reason, Schedules, Servers, TotalActive, TotalAggregating, TotalArchived, TotalCompleted, TotalFailed, TotalFailedAll, TotalPending, TotalProcessed, TotalProcessedAll, TotalQueues, TotalRetry, TotalScheduled, TotalSchedules, TotalServers, TotalSize, TotalWorkers, Workers
  • RuntimeWorkerSnapshot — fields Deadline, Host, PID, Queue, ServerID, StartedAt, TaskID, TaskType
  • Scheduler interface — methods Close, RegisterJSON, Start, Unregister
  • Task interface — methods Payload, Type

Functions — DecodeJSONPayload, DefaultEnqueuePolicy, NormalizeQueueAction, SupportedQueueActions

Constants — QueueActionArchiveRetry, QueueActionPause, QueueActionPurgeArchived, QueueActionRetry, QueueActionRetryArchived, QueueActionUnpause

Variables — ErrNilHandler, ErrNilManager, ErrRedisURLRequired, ErrTaskTypeRequired

pkg/validate​

github.com/jcsvwinston/nucleus/pkg/validate · 2 symbols · pkg.go.dev

Functions — RegisterRule, Validate

Fields an extension may rely on​

An app.Extension receives the whole *app.App. These are the 20 fields of App that Nucleus freezes for extensions, kept in contracts/baseline/extension_surface.txt and compared with the code by the same CI: removing one, or adding one without listing it, fails the build.

  • AuthChain *auth.Chain
  • AuthFederated *auth.FederatedSet
  • Authorizer *authz.Enforcer
  • Cache cache.Cache
  • Config *app.Config
  • DB *db.DB
  • DBs map[string]*db.DB
  • I18n *i18n.Translator
  • JWT *auth.JWTManager
  • Logger *slog.Logger
  • Mailer mail.Sender
  • Models *model.Registry
  • Observability *observability.Bus
  • Outbox *outbox.ManagedOutbox
  • Realtime *realtime.Hub
  • Router *router.Router
  • Session *auth.SessionManager
  • SessionRecorder *hooks.SessionRecorder
  • Storage provider.Store
  • Templates *template.Template