Documentation
¶
Overview ¶
Package gst defines the public contracts between the framework and business projects: the Model, Service, Database, Selector, Cache, RBAC, and Logger interfaces, the query building blocks they exchange (Filter, Order, Cursor, Column, Term, Window), the per-request ServiceContext, and the Error a request is answered with.
Index ¶
- Constants
- Variables
- func RequestUserID(ctx context.Context) string
- type AnyColumnRef
- type Assignment
- type Bound
- type Cache
- type Column
- type ColumnRef
- type ControllerConfig
- type Cursor
- type Database
- type DatabaseOption
- type Decision
- type ESDocumenter
- type Error
- type Expr
- type Filter
- type FilterOp
- type JoinSource
- type Logger
- type Model
- type Module
- type NumericColumn
- type Order
- type Ordering
- type Permission
- type QueryOptions
- type RBAC
- type Request
- type Response
- type SQLStatement
- type SelectBranch
- type Selector
- type Service
- type ServiceContext
- type TableNamer
- type Term
- type TermCondition
- type TermOrder
- type TimeColumn
- type Union
- type Window
Constants ¶
const ( FilterOpEq = types.FilterOpEq // equal: column = value FilterOpNe = types.FilterOpNe // not equal: column <> value FilterOpGt = types.FilterOpGt // greater than: column > value FilterOpGte = types.FilterOpGte // greater than or equal: column >= value FilterOpLt = types.FilterOpLt // less than: column < value FilterOpLte = types.FilterOpLte // less than or equal: column <= value FilterOpIn = types.FilterOpIn // set membership: column IN (comma-separated values) FilterOpNotIn = types.FilterOpNotIn // set exclusion: column NOT IN (comma-separated values) FilterOpLike = types.FilterOpLike // substring match: column LIKE %value% FilterOpNotLike = types.FilterOpNotLike // substring exclusion: column NOT LIKE %value% FilterOpStartsWith = types.FilterOpStartsWith // prefix match: column LIKE value% (can use an index) FilterOpEndsWith = types.FilterOpEndsWith // suffix match: column LIKE %value FilterOpIsNull = types.FilterOpIsNull // null check: value true means IS NULL, false means IS NOT NULL )
URL-exposed operators, which a request spells as "field[op]=value".
const ( FilterOpRegex = types.FilterOpRegex // regular expression match: column REGEXP value (dialect-aware) FilterOpNotRegex = types.FilterOpNotRegex // regular expression exclusion: NOT (column REGEXP value) FilterOpJSONContains = types.FilterOpJSONContains // JSON array membership: value is a member of the JSON array column FilterOpOr = types.FilterOpOr // group: the []Filter value is OR-combined, the group itself AND-combined FilterOpAnd = types.FilterOpAnd // group: the []Filter value is AND-combined, for nesting inside an OR group FilterOpExists = types.FilterOpExists // correlated subquery: EXISTS or NOT EXISTS over a related model FilterOpEqCol = types.FilterOpEqCol // column equals another column: the enclosing query's inside a subquery, a table read beside it inside a join FilterOpFalse = types.FilterOpFalse // constant predicate: matches nothing, see FilterFalse )
Service-only operators, which service code builds and no request can spell.
const DefaultCountAlias = types.DefaultCountAlias
DefaultCountAlias is the alias COUNT(*) projects under when the caller does not rename it. A column term defaults to its column name, but COUNT(*) names no column, so without a default of its own it would be the one term that always had to be renamed.
Variables ¶
var ( // NewError creates the error a request is answered with: status and a // client-safe message. // // The status must be a 4xx or 5xx HTTP status code. Invalid statuses, including // 2xx/3xx success or redirect statuses such as http.StatusOK, are normalized to // http.StatusInternalServerError and the provided message is discarded. NewError = types.NewError // NewErrorWithCause creates the error a request is answered with, carrying // an internal cause. // // The status must be a 4xx or 5xx HTTP status code. Invalid statuses, including // 2xx/3xx success or redirect statuses such as http.StatusOK, are normalized to // http.StatusInternalServerError and the provided message is discarded. // // The cause is reported by Error for logs and available through Unwrap, but // is never exposed as the response message. NewErrorWithCause = types.NewErrorWithCause )
The constructors are forwarded as variables instead of wrapper functions on purpose: a wrapper function would add its own frame on top of the stack trace captured at the construction site.
var ErrEntryNotFound = types.ErrEntryNotFound
ErrEntryNotFound is returned when a cache entry is not found, or when the stored value cannot be decoded as the handle's type and the entry is dropped.
var ErrTTLNotSupported = types.ErrTTLNotSupported
ErrTTLNotSupported is returned by Cache.Set when the backend cannot honor the requested ttl semantics, such as a per-entry lifetime on a backend without per-entry expiration.
Functions ¶
func RequestUserID ¶
RequestUserID reports the authenticated subject of the request ctx descends from, or "" when no request is behind it.
Types ¶
type AnyColumnRef ¶
type AnyColumnRef = types.AnyColumnRef
AnyColumnRef is the type-erased view of every generated column reference, for options that take a heterogeneous column list: WithSelect accepts columns of different Go types in one call, which the parameterized ColumnRef cannot express. The unexported method keeps the set of implementations closed to the framework, so a stray type that happens to carry a Name method cannot slip into a column list.
type Assignment ¶
type Assignment = types.Assignment
Assignment is one column-value write, the unit UpdateByID accepts. Service code builds assignments through the generated column references (SampleCols.Status.Set(v)), whose typed front end stops a wrong-typed value or a misspelled column at compile time; generic code assigns through a reference minted for its type parameter. Its fields are unexported, so those references are the only way to build one; Table, Column and Value read it back.
type Bound ¶
Bound is one end of the range a column's comparison filters confine it to: the value at that end, whether the range includes it, and whether any filter gave that end at all. An absent end leaves the range open on that side.
type Column ¶
Column is a typed reference to a database column, generated per model by gg gen. T is the Go type of the column, so a filter built through a Column cannot name a column that does not exist nor bind a value of the wrong type: both mistakes stop at compile time instead of surfacing as a SQL error or a silently wrong result set.
func NewColumn ¶
func NewColumn[M TableNamer, T any](name string) Column[T]
NewColumn returns a typed reference to the named column of M's table. gg gen emits the calls in each model's generated file, naming the model as the first type argument, so the table comes from the model's own TableName and is never restated as a literal. Handwritten code, model hooks included, reads those generated Cols vars; gg check flags project code that mints a reference instead, with two exceptions. Generic code has no concrete model and so no Cols var: it names its type parameter as the model, and NewColumn[M, string]("id").In(ids...) keeps the value type checked where a plain column name would not. Module sources have no generated file and name their model the way gg gen does. The fields are unexported so a shared reference cannot be repointed at another column after construction.
type ColumnRef ¶
ColumnRef is the shared typed view of every generated column reference. Helpers that accept a column take this interface rather than a concrete struct, because embedding is not subtyping in Go: NumericColumn[T] cannot be passed where Column[T] is expected, so a helper typed on the struct would reject exactly the numeric and time columns it is most often used with.
type ControllerConfig ¶
type ControllerConfig[M Model] = types.ControllerConfig[M]
ControllerConfig customizes how router.Register builds an internal handler for a route. It is the public configuration surface for controller behavior; the concrete controller handlers and their runtime state remain framework-owned.
type Cursor ¶
Cursor is where a cursor-paginated read starts and which way it goes: the feed's stable ordering, the boundary row, and whether the read travels along that ordering or back down it. Its fields are unexported, so a cursor comes from CursorForward, CursorBackward or the framework's URL parsing; Order, Value and Backward read it back.
func CursorBackward ¶
CursorBackward pages against order, starting just before value.
func CursorForward ¶
CursorForward pages along order, starting just past value.
type Database ¶
Database defines the model-scoped database operation contract. It provides CRUD operations, query builders, and optional dry-run behavior for a single Model type.
type DatabaseOption ¶
type DatabaseOption[M Model] = types.DatabaseOption[M]
DatabaseOption provides chainable options for a single Database operation chain. Options apply to the next terminal operation and are reset afterward. Start a new chain with database.Database[M](ctx) for each independent operation.
type ESDocumenter ¶
type ESDocumenter = types.ESDocumenter
ESDocumenter represents a document that can be indexed into Elasticsearch. Types implementing this interface should be able to convert themselves into a document format suitable for Elasticsearch indexing.
type Error ¶
Error is the error a request is answered with: a status and a client-safe message, with an internal cause for the logs. A service method, a model hook, a middleware or an interceptor returns it to refuse a request with a status of its own; any other error is the server's failure, answered 500.
type Expr ¶
Expr is what a projection selects and a window partitions by: a column reference, projected as it is stored, or a Term. The set is closed to the framework, so a projection can never carry SQL text.
type Filter ¶
Filter is one field-level filter to apply as an AND condition: the column it compares, the table that column belongs to, the operator and the value. Its fields are unexported, so a filter comes from the generated column references, a reference minted for a type parameter, the grouping, subquery and constant constructors below, or the framework's URL parsing. Table, Column, Op and Value read it back; Split, Values, ExcludedValues and Bounds on a column reference read one column's filters converted to the column's type. A filter carrying another table is applied to that table when the query joins it and fails closed otherwise, and the value is always bound as a statement parameter.
func FilterAnd ¶
FilterAnd groups filters that are AND-combined with each other. Filters are already AND-combined at the top level, so the group exists to nest an AND inside an OR group.
func FilterExists ¶
FilterExists matches rows of the queried model that have at least one related row in C satisfying filters. EqCol predicates tie the related rows to the queried row, one per column pair, next to the ordinary conditions narrowing them.
func FilterFalse ¶
func FilterFalse() Filter
FilterFalse matches nothing. It is the condition a permission hook returns when the caller may see no row at all. Unlike an empty filter list it is a real condition, so it disables the empty-query safety check; unlike a filter the renderer cannot apply it is deliberate, so nothing is logged. It renders as 1 = 0 on every dialect and composes like any other filter, inside groups, subqueries and conditional measures included.
func FilterNotExists ¶
FilterNotExists matches rows that have no related row in C satisfying filters. Note that it is not the negation of a filtered FilterExists over the same rows: a row whose related rows all fail filters matches, and so does a row with no related rows at all. A subquery without any EqCol predicate fails closed here as well: negating "match nothing" would otherwise widen into "match everything".
type FilterOp ¶
FilterOp is a field-level filter operator: the comparison a Filter applies, which Filter.Op reads back. Operators never widen a query: unknown values are rejected during parsing, and the database layer fails closed on conditions it does not recognize.
type JoinSource ¶
type JoinSource = types.JoinSource
JoinSource is a source a select joins to its model. The set is closed to the framework: Join and LeftJoin join a model on a unique key, JoinSelect and LeftJoinSelect join a grouped select on its group keys.
func Join ¶
func Join[C Model](on ...Filter) JoinSource
Join joins model C on a unique key: JOIN, keeping only the rows of the query that match a row of C. The predicates are the ON condition.
func JoinSelect ¶
func JoinSelect[R any](sub SelectBranch[R], on ...Filter) JoinSource
JoinSelect joins a grouped select as a derived table, JOIN (SELECT ...) AS jN ON ..., keeping only the rows of the query that match one of its groups. This is how a one-to-many relation is read beside its one side: the many side is grouped by the key first, so every key has one row, and that row is joined.
func LeftJoin ¶
func LeftJoin[C Model](on ...Filter) JoinSource
LeftJoin joins model C on a unique key, keeping the rows of the query that match no row of C with the joined columns NULL: LEFT JOIN. The rules match Join; the result fields the joined columns bind to must hold NULL.
func LeftJoinSelect ¶
func LeftJoinSelect[R any](sub SelectBranch[R], on ...Filter) JoinSource
LeftJoinSelect joins a grouped select as a derived table, keeping the rows of the query that match none of its groups with the select's terms NULL: LEFT JOIN. The rules match JoinSelect; the result fields the select's terms bind to must hold NULL.
type Logger ¶
Logger is the logger the framework hands to services and modules and keeps in the logger package's streams. It writes an entry plain and printf-style, sugared with key/value fields (the "w" methods) and with typed zap.Field values (the "z" methods); With attaches string key/value fields and WithContext derives a logger carrying request metadata fields.
type Model ¶
Model defines the framework contract for database-backed and action models. Typical database resources embed model.Base (UUIDv7 string primary key) or model.AutoBase (auto-increment integer primary key). Action-only models may use model.Empty when they do not represent persistent rows.
type Module ¶
Module describes a registered API module: route metadata, auth exposure, resource parameter name, and the service implementation used by controllers.
type NumericColumn ¶
type NumericColumn[T any] = types.NumericColumn[T]
NumericColumn is the reference generated for a column whose Go type is numeric. It embeds Column, so every filter and order stays available, and adds the aggregate functions that only make sense over a number.
func NewNumericColumn ¶
func NewNumericColumn[M TableNamer, T any](name string) NumericColumn[T]
NewNumericColumn returns the numeric reference to the named column of M's table, carrying Sum and Avg on top of everything Column has.
type Order ¶
Order is one ORDER BY term: a column and the direction to sort it by. Its fields are unexported, so an order comes from a generated column reference, a reference minted for a type parameter, or the framework's URL parsing; Table, Column and Descending read it back, and SortsBy tells whether it sorts by a given column. Table is filled in by a column reference and left empty by URL parsing. The chain's reads and a select check it: a select that joins tells two tables' columns of one name apart by it, and a chain refuses an order of another model. A union orders its result columns by name and reads no table, and WithExpand orders the associated table, so neither checks it. An Order with an empty column is skipped rather than rendered.
type Ordering ¶
Ordering is what the OrderBy methods of a select, a window and a union accept: an Order sorting by a column reference, or a TermOrder sorting by a projection term. The set is closed, so an ordering can never carry SQL the way a free-form string could.
type Permission ¶
type Permission = types.Permission
Permission is one operation a role is allowed to perform on one object. It is the unit the whole-set replacement methods on RBAC take, so a caller states a role's permissions as a set rather than as a sequence of grants.
type QueryOptions ¶
type QueryOptions = types.QueryOptions
QueryOptions tunes how WithQuery turns a model value into WHERE conditions. Every condition it produces is AND-combined; the zero value means exact matching with the empty-query safety check enabled. See the WithQuery method for usage examples.
type RBAC ¶
RBAC provides tenant-scoped role, permission, and subject assignment operations. A process holding no policy set — RBAC disabled, or not initialized — answers reads as the deployment they describe, denying every request and reporting no roles, and refuses every write rather than reporting a change it did not make.
type Request ¶
Request and Response are the framework-facing types of one action's request and response payloads. They constrain the REQ and RSP type parameters of Service and Module; the concrete types are declared per action by the model layer.
type Response ¶
Request and Response are the framework-facing types of one action's request and response payloads. They constrain the REQ and RSP type parameters of Service and Module; the concrete types are declared per action by the model layer.
type SQLStatement ¶
type SQLStatement = types.SQLStatement
SQLStatement contains a generated SQL statement in executable and rendered forms.
type SelectBranch ¶
type SelectBranch[R any] = types.SelectBranch[R]
SelectBranch is a select in the role of a branch of a union: every Selector is one, with its model type erased, so that selects over different models stack into one result as long as they scan into the same row type. The role is what UnionAll takes. Only the selects the database layer builds can fill it; UnionAll fails when handed anything else, a union among them.
type Selector ¶
Selector runs an analytical read over the table of M and scans the result rows into R. It is deliberately separate from Database[M]: a projected row is not a model row, so model hooks, association preloading and cursor pagination have nothing to act on and are absent here rather than present and inert.
type Service ¶
Service defines the controller-facing business operation contract for a model. Generated controllers call these methods for CRUD, batch CRUD, lifecycle hooks, import/export, filtering, and logging.
type ServiceContext ¶
type ServiceContext = types.ServiceContext
ServiceContext is the per-request context the framework hands to every service method. It implements context.Context by delegating to the request context, exposes request metadata (route, params, user identity, trace), and carries the response helpers a service needs without touching Gin directly.
type TableNamer ¶
type TableNamer = types.TableNamer
TableNamer is the one method a column reference needs from its model: the table the column belongs to. Every Model satisfies it; the narrower interface lets a reference name its model as a type argument alone, with nothing else of the model contract in play.
type Term ¶
Term is one term of a projection: a group key, a plain column, a constant, a measure, or a window function. Column references build it, as do Count, the ranking functions and Literal below.
func Count ¶
func Count() Term
Count counts rows: COUNT(*). It counts a row even when every column is NULL, which is what a plain row count means; use a column reference's Count for COUNT(column), which skips NULLs.
func Literal ¶
Literal projects a constant, which is how the branches of a union tell their rows apart.
func Rank ¶
func Rank() Term
Rank ranks the rows of each partition in the window's order. Rows sorting equal share a rank and the next rank skips past them: 1, 2, 2, 4.
func RowNumber ¶
func RowNumber() Term
RowNumber numbers the rows of each partition from 1 in the window's order, with no ties: two rows sorting equal still get consecutive numbers, in a stable order the framework completes with the primary key. Like Rank and DenseRank it only exists over a window whose OrderBy is set, which Over declares: without an order there is no first row to number.
type TermCondition ¶
type TermCondition = types.TermCondition
TermCondition is one condition on a projected term: a Having condition on a measure, or a Qualify condition on a window function. It carries the term itself rather than an alias string, which has two consequences: a condition can never name a term the projection did not declare, and the renderer can emit the full expression instead of the alias, which HAVING requires because PostgreSQL does not accept an output alias there.
type TermOrder ¶
TermOrder is one ORDER BY term of a select or of a window. Unlike Order it sorts by a projection term, which is what a TopN report ranks by.
type TimeColumn ¶
type TimeColumn = types.TimeColumn
TimeColumn is the reference generated for a column holding a time value: time.Time, or datatypes.Date, the calendar day a date column stores and binds as a time at midnight. It embeds Column and adds time bucketing, which is only meaningful over a time value and produces garbage rather than an error on some dialects when it is not.
func NewTimeColumn ¶
func NewTimeColumn[M TableNamer](name string) TimeColumn
NewTimeColumn returns the time reference to the named column of M's table, carrying the bucketing group keys on top of everything Column has.
type Union ¶
Union stacks the rows of several selects into one result: UNION ALL, the one set operation the framework offers. UNION proper would fold two rows that happen to be equal — two payments of the same amount on the same day — into one, which no report wants; INTERSECT and EXCEPT are the semi joins FilterExists and FilterNotExists already express.
type Window ¶
Window names the rows a window function reads for each row: PartitionBy splits the rows into partitions, and OrderBy orders each partition, which is what gives a running total its direction and a row number its sequence.
func OrderBy ¶
OrderBy returns a Window with no partition and the given orders: the window a ranking across every row reads. It is the short spelling of PartitionBy().OrderBy(orders...), the two building the same window; a window with keys starts from PartitionBy. It orders the window, not the result: the result is ordered by the Selector's OrderBy.
func PartitionBy ¶
PartitionBy opens a window partitioned by keys. Without keys the whole result is one partition, which is what a ranking over every row wants, and the window is the one OrderBy opens: the two spellings build the same value, so a term declared with one is found by the other.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apidoc keeps a registry of Go struct doc comments used to enrich the generated OpenAPI document.
|
Package apidoc keeps a registry of Go struct doc comments used to enrich the generated OpenAPI document. |
|
Package authn exposes the authentication extension points that optional modules install into the mandatory IAM login flow.
|
Package authn exposes the authentication extension points that optional modules install into the mandatory IAM login flow. |
|
authz
|
|
|
rbac
Package rbac decides authorization from stored policy rules and keeps those rules in step with the records they are derived from.
|
Package rbac decides authorization from stored policy rules and keeps those rules in step with the records they are derived from. |
|
Package bootstrap brings a gst process up and takes it down again.
|
Package bootstrap brings a gst process up and takes it down again. |
|
Package cache is the public facade of the framework's in-memory cache.
|
Package cache is the public facade of the framework's in-memory cache. |
|
Package client is the official HTTP client for gst backends, designed as the client-side pairing of the framework's DSL: every HTTP interface shape a model's Design() can declare has a first-class counterpart here; the Stream action is served over gRPC alone and has none.
|
Package client is the official HTTP client for gst backends, designed as the client-side pairing of the framework's DSL: every HTTP interface shape a model's Design() can declare has a first-class counterpart here; the Stream action is served over gRPC alone and has none. |
|
cmd
|
|
|
gg
command
|
|
|
Package component runs a project's own long-running work alongside the server — a consumer loop, a poller, a watcher: work that runs on every replica for the life of the process.
|
Package component runs a project's own long-running work alongside the server — a consumer loop, a poller, a watcher: work that runs on every replica for the life of the process. |
|
Package config loads the application configuration: the framework's own sections, held by App, and the sections a project adds with Register.
|
Package config loads the application configuration: the framework's own sections, held by App, and the sections a project adds with Register. |
|
Package consts holds the names a project shares with the framework: the phases of an action, the row lock modes a query asks for, the operations an operation log records, the context keys of the caller, the authorization vocabulary, and the rule of the path of a route.
|
Package consts holds the names a project shares with the framework: the phases of an action, the row lock modes a query asks for, the operations an operation log records, the context keys of the caller, the authorization vocabulary, and the rule of the path of a route. |
|
Package cronjob runs the jobs a project registers on a schedule.
|
Package cronjob runs the jobs a project registers on a schedule. |
|
Package database provides the framework database facade built on top of GORM.
|
Package database provides the framework database facade built on top of GORM. |
|
Package dbmigrate renders registered Go models into a target schema and migrates a database towards it.
|
Package dbmigrate renders registered Go models into a target schema and migrates a database towards it. |
|
Package dcache provides a replicated in-memory cache: a per-process store whose set and delete operations propagate to the store of every other instance through Kafka events.
|
Package dcache provides a replicated in-memory cache: a per-process store whose set and delete operations propagate to the store of every other instance through Kafka events. |
|
debug
|
|
|
pprof
Package debugpprof provides an HTTP server for pprof endpoints; the package name avoids conflicting with the standard library "pprof" packages.
|
Package debugpprof provides an HTTP server for pprof endpoints; the package name avoids conflicting with the standard library "pprof" packages. |
|
ds
|
|
|
list/arraylist
Package arraylist provides a generic implementation of a resizable array-backed list.
|
Package arraylist provides a generic implementation of a resizable array-backed list. |
|
list/linkedlist
Package linkedlist provides an implementation of a doubly-linked list with a front and back.
|
Package linkedlist provides an implementation of a doubly-linked list with a front and back. |
|
Package dsl provides a Domain Specific Language (DSL) for defining REST API designs for Go models.
|
Package dsl provides a Domain Specific Language (DSL) for defining REST API designs for Go models. |
|
Package grpc is the gRPC listener's API for a project's own code.
|
Package grpc is the gRPC listener's API for a project's own code. |
|
Package interceptor is the gRPC counterpart of package middleware: the interceptors a project mounts on the gRPC listener.
|
Package interceptor is the gRPC counterpart of package middleware: the interceptors a project mounts on the gRPC listener. |
|
internal
|
|
|
cache/cachetest
Package cachetest provides the conformance suite every types.Cache backend must pass.
|
Package cachetest provides the conformance suite every types.Cache backend must pass. |
|
cache/capacity
Package capacity resolves the per-type entry bound shared by the entry-addressed cache backends, so the configuration is read and validated in one place rather than copied into each of them.
|
Package capacity resolves the per-type entry bound shared by the entry-addressed cache backends, so the configuration is read and validated in one place rather than copied into each of them. |
|
cache/codec
Package codec encodes cache values for the backends that store bytes rather than live objects.
|
Package codec encodes cache values for the backends that store bytes rather than live objects. |
|
cache/freelru
Package freelru is a sharded LRU cache that stores live values.
|
Package freelru is a sharded LRU cache that stores live values. |
|
cache/otter
Package otter is a W-TinyLFU cache.
|
Package otter is a W-TinyLFU cache. |
|
cache/registry
Package registry provides the shared per-type singleton store used by the in-memory cache backends.
|
Package registry provides the shared per-type singleton store used by the in-memory cache backends. |
|
cache/ristretto
Package ristretto is a TinyLFU-admission cache.
|
Package ristretto is a TinyLFU-admission cache. |
|
cache/tracing
Package tracing wraps cache backends that talk to remote systems with OpenTelemetry spans.
|
Package tracing wraps cache backends that talk to remote systems with OpenTelemetry spans. |
|
cmd/apidocgen
command
Command apidocgen regenerates the apidoc registration file of the framework package that ships struct doc comments to the OpenAPI generator.
|
Command apidocgen regenerates the apidoc registration file of the framework package that ships struct doc comments to the OpenAPI generator. |
|
cmd/selfcheck
command
Command selfcheck holds the framework's own source to the rules golangci-lint cannot express, and prints each violation it finds.
|
Command selfcheck holds the framework's own source to the rules golangci-lint cannot express, and prints each violation it finds. |
|
cmd/testcachefix
command
Command testcachefix writes back the test results go keeps under one key only, so a cached test never links its binary again.
|
Command testcachefix writes back the test results go keeps under one key only, so a cached test never links its binary again. |
|
controller
Package controller serves the actions of the registered routes on both transports: over HTTP through the handlers the router mounts (CreateHandler and its kind), over gRPC through the call functions the generated pb package runs (CreateCall and its kind).
|
Package controller serves the actions of the registered routes on both transports: over HTTP through the handlers the router mounts (CreateHandler and its kind), over gRPC through the call functions the generated pb package runs (CreateCall and its kind). |
|
dbruntime/dbnode
Package dbnode names the roles of the nodes a database handle writes to and reads from, and stamps the role that serves a statement on the statement's context, for the SQL log to report which node ran it.
|
Package dbnode names the roles of the nodes a database handle writes to and reads from, and stamps the role that serves a statement on the statement's context, for the SQL log to report which node ran it. |
|
dsl
Package dsl reads the designs the models of a project declare with the keywords of the public dsl package: Parse turns a model file into the Design of each of its models, Validate reports the declarations the generator cannot honor, and Design and Action are what gg gen, gg check and the generators consume.
|
Package dsl reads the designs the models of a project declare with the keywords of the public dsl package: Parse turns a model file into the Design of each of its models, Validate reports the declarations the generator cannot honor, and Design and Action are what gg gen, gg check and the generators consume. |
|
errorstack
Package errorstack extracts stack traces embedded in errors, shared by tracing and logging so both report the same error origin stack format.
|
Package errorstack extracts stack traces embedded in errors, shared by tracing and logging so both report the same error origin stack format. |
|
execctx
Package execctx carries the identity of the unit of work a context belongs to.
|
Package execctx carries the identity of the unit of work a context belongs to. |
|
ggcheck
Package ggcheck holds the rules gg check holds a business project to.
|
Package ggcheck holds the rules gg check holds a business project to. |
|
ggconfig
Package ggconfig loads the project-level gst configuration file (gst.yaml) that gg commands consume at build time.
|
Package ggconfig loads the project-level gst configuration file (gst.yaml) that gg commands consume at build time. |
|
ggconst
Package ggconst holds the conventions the framework's tooling shares: the import paths of the framework packages, the names of the files, packages and fields gg generates and reads, and the patterns it recognizes them by.
|
Package ggconst holds the conventions the framework's tooling shares: the import paths of the framework packages, the names of the files, packages and fields gg generates and reads, and the patterns it recognizes them by. |
|
gggen
Package gggen builds the code gg gen writes: the registration files, the service files and their test scaffolds, and, in its sub-packages, the column references, the TypeScript declarations and the protobuf definitions.
|
Package gggen builds the code gg gen writes: the registration files, the service files and their test scaffolds, and, in its sub-packages, the column references, the TypeScript declarations and the protobuf definitions. |
|
gggen/columns
Package columns generates the typed column references of a project's models, so filters name columns through the compiler instead of through string literals.
|
Package columns generates the typed column references of a project's models, so filters name columns through the compiler instead of through string literals. |
|
gggen/jsonshape
Package jsonshape reads what the types of a gst project look like on the wire: the JSON encoding/json writes for them, which is the codec of the framework's response envelope and request binding.
|
Package jsonshape reads what the types of a gst project look like on the wire: the JSON encoding/json writes for them, which is the codec of the framework's response envelope and request binding. |
|
gggen/jsonshape/fixture/a-b
Package ab lives in a directory whose name maps to the same TypeScript import name as the a_b fixture package.
|
Package ab lives in a directory whose name maps to the same TypeScript import name as the a_b fixture package. |
|
gggen/jsonshape/fixture/a_b
Package ab lives in a directory whose name maps to the same TypeScript import name as the a-b fixture package.
|
Package ab lives in a directory whose name maps to the same TypeScript import name as the a-b fixture package. |
|
gggen/jsonshape/fixture/gst
Package gst sits where its output file would be gst.ts, the name of the framework prelude.
|
Package gst sits where its output file would be gst.ts, the name of the framework prelude. |
|
gggen/jsonshape/fixture/mode
Package mode declares an enum type another fixture package declares a further constant of.
|
Package mode declares an enum type another fixture package declares a further constant of. |
|
gggen/jsonshape/fixture/model/record
Package record declares a fixture type the sample fixture refers to from another package.
|
Package record declares a fixture type the sample fixture refers to from another package. |
|
gggen/jsonshape/fixture/model/sample
Package sample declares the fixture types the TypeScript generator tests start from.
|
Package sample declares the fixture types the TypeScript generator tests start from. |
|
gggen/jsonshape/fixture/pkg/notifier
Package notifier declares a fixture type a model refers to from outside the model directory.
|
Package notifier declares a fixture type a model refers to from outside the model directory. |
|
gggen/jsonshape/fixture/unsupported
Package unsupported declares fixture types whose JSON shape the TypeScript generator cannot describe.
|
Package unsupported declares fixture types whose JSON shape the TypeScript generator cannot describe. |
|
gggen/pb
Package pb generates the protobuf definitions of a gst project's gRPC services and the Go files serving them: for every model whose Design declares GRPC(), the messages its Go types encode to and the service exposing its actions, printed as .proto files that mirror the model directory under pb/; beside each, a .gen.go with the type serving the service, the calls of its actions, the handlers of its rpcs and the conversions between the messages and the Go types (see handlerFile); and, in every package under pb/, a pb.gen.go registering its services on the listener (see registrationFiles).
|
Package pb generates the protobuf definitions of a gst project's gRPC services and the Go files serving them: for every model whose Design declares GRPC(), the messages its Go types encode to and the service exposing its actions, printed as .proto files that mirror the model directory under pb/; beside each, a .gen.go with the type serving the service, the calls of its actions, the handlers of its rpcs and the conversions between the messages and the Go types (see handlerFile); and, in every package under pb/, a pb.gen.go registering its services on the listener (see registrationFiles). |
|
gggen/ts
Package ts generates the TypeScript declarations of the Go types a gst project's API routes send and receive.
|
Package ts generates the TypeScript declarations of the Go types a gst project's API routes send and receive. |
|
gghelper
Package gghelper holds what more than one of gg's packages needs about the project gg runs in: the module path its go.mod declares, the paths gg leaves out of it, the ones its Git ignore rules exclude and the ones the go command leaves out, programs and package listings run against its module, and the small file and path helpers the commands share.
|
Package gghelper holds what more than one of gg's packages needs about the project gg runs in: the module path its go.mod declares, the paths gg leaves out of it, the ones its Git ignore rules exclude and the ones the go command leaves out, programs and package listings run against its module, and the small file and path helpers the commands share. |
|
ggmodule
Package ggmodule implements the behavior behind the gg module command family: discovering framework modules (list), registering a module import in the project's module/module.go (add, remove), and materializing a module into the project as project-owned source (copy).
|
Package ggmodule implements the behavior behind the gg module command family: discovering framework modules (list), registering a module import in the project's module/module.go (add, remove), and materializing a module into the project as project-owned source (copy). |
|
ggnew
Package ggnew scaffolds the project gg new creates: the first version of every package the generated main.go imports, so the project compiles before its first generation.
|
Package ggnew scaffolds the project gg new creates: the first version of every package the generated main.go imports, so the project compiles before its first generation. |
|
ggprune
Package ggprune works out what gg prune deletes from a project's service directory, and deletes it: the service files of disabled actions, the unmanaged files of service directories no model owns, and the directories that leaves empty.
|
Package ggprune works out what gg prune deletes from a project's service directory, and deletes it: the service files of disabled actions, the unmanaged files of service directories no model owns, and the directories that leaves empty. |
|
grpcserver
Package grpcserver serves the gRPC services of the models declaring GRPC(), on a listener of its own beside the HTTP one and on the same lifecycle: bootstrap starts it with the other listeners, drains it with the readiness probe and stops it side by side with the HTTP listener within the shutdown's window, its streams ending as the stop begins.
|
Package grpcserver serves the gRPC services of the models declaring GRPC(), on a listener of its own beside the HTTP one and on the same lifecycle: bootstrap starts it with the other listeners, drains it with the readiness probe and stops it side by side with the HTTP listener within the shutdown's window, its streams ending as the stop begins. |
|
hookoverride
Package hookoverride tells whether a type overrides a method beyond the framework base it embeds, reading the answer off the compiled binary.
|
Package hookoverride tells whether a type overrides a method beyond the framework base it embeds, reading the answer off the compiled binary. |
|
instance
Package instance answers one question — which process is this — for every part of the framework that tells replicas apart: the field every log entry carries, the tracing resource, the origin a replicated cache event names.
|
Package instance answers one question — which process is this — for every part of the framework that tells replicas apart: the field every log entry carries, the tracing resource, the origin a replicated cache event names. |
|
lease
Package lease is the coordination primitive the framework's distributed capabilities stand on: a name that at most one healthy process among those sharing the primary database holds at a time.
|
Package lease is the coordination primitive the framework's distributed capabilities stand on: a name that at most one healthy process among those sharing the primary database holds at a time. |
|
lifecycle
Package lifecycle is the registry of the framework components that have a lifetime of their own: clients of external systems, the scheduler, election loops, anything that owns a connection or a background goroutine — and, through the component package, a project's own long-running work.
|
Package lifecycle is the registry of the framework components that have a lifetime of their own: clients of external systems, the scheduler, election loops, anything that owns a connection or a background goroutine — and, through the component package, a project's own long-running work. |
|
logfield
Package logfield declares the log fields more than one stream of the framework writes, each as one constructor fixing the field's key and its type.
|
Package logfield declares the log fields more than one stream of the framework writes, each as one constructor fixing the field's key and its type. |
|
middleware
Package middleware holds the middleware the framework mounts itself and the machinery that mounts the rest: the built-in chain ahead of every route, the registry of the middlewares projects and modules register, and the registries the router fills as routes register — route parameters and streaming routes — together with the circuit breaker built from configuration at startup.
|
Package middleware holds the middleware the framework mounts itself and the machinery that mounts the rest: the built-in chain ahead of every route, the registry of the middlewares projects and modules register, and the registries the router fills as routes register — route parameters and streaming routes — together with the circuit breaker built from configuration at startup. |
|
modelinfo
Package modelinfo reads the models of a project the way gg sees them: the model files under the model directory, each model with the design its DSL declares, its routes resolved through the resource hierarchy and the gst.yaml ignore rules, the service files its actions map to, and the doc comments the API document registers.
|
Package modelinfo reads the models of a project the way gg sees them: the model files under the model directory, each model with the design its DSL declares, its routes resolved through the resource hierarchy and the gst.yaml ignore rules, the service files its actions map to, and the doc comments the API document registers. |
|
modelinspect
Package modelinspect inspects a project's models by running them.
|
Package modelinspect inspects a project's models by running them. |
|
modelregistry
Package modelregistry contains the internal model infrastructure behind the public model package.
|
Package modelregistry contains the internal model infrastructure behind the public model package. |
|
modelschema
Package modelschema resolves what a model struct declares about its table: its database columns, the secondary indexes it declares (see Index), its optimistic-locking column (see Version) and the columns identifying one of its rows (see IdentifyingColumns).
|
Package modelschema resolves what a model struct declares about its table: its database columns, the secondary indexes it declares (see Index), its optimistic-locking column (see Version) and the columns identifying one of its rows (see IdentifyingColumns). |
|
router
Package router builds the HTTP server a gst process serves: the engine carrying the framework's middleware chain and operational endpoints, the route groups registered routes attach to, the routes-ready hooks, and the server's start and shutdown.
|
Package router builds the HTTP server a gst process serves: the engine carrying the framework's middleware chain and operational endpoints, the route groups registered routes attach to, the routes-ready hooks, and the server's start and shutdown. |
|
serviceregistry
Package serviceregistry owns the framework-internal service registry used by controllers and modules.
|
Package serviceregistry owns the framework-internal service registry used by controllers and modules. |
|
sse
Package sse implements Server-Sent Events (SSE) for the framework.
|
Package sse implements Server-Sent Events (SSE) for the framework. |
|
structdoc
Package structdoc parses Go source code and extracts the doc comments of exported struct declarations and their exported fields.
|
Package structdoc parses Go source code and extracts the doc comments of exported struct declarations and their exported fields. |
|
testutil/oteltest
Package oteltest turns real OpenTelemetry tracing on inside one framework test and reads back the spans it exports.
|
Package oteltest turns real OpenTelemetry tracing on inside one framework test and reads back the spans it exports. |
|
testutil/swap
Package swap replaces process-wide values for the duration of one test.
|
Package swap replaces process-wide values for the duration of one test. |
|
testutil/testcontainer
Package testcontainer prepares the services the framework's tests run against, in containers started through testcontainers-go.
|
Package testcontainer prepares the services the framework's tests run against, in containers started through testcontainers-go. |
|
testutil/testlog
Package testlog keeps the framework's logs of a test process out of the test output and out of the package source tree, where log files changing with every run would make go's test cache rerun every test that reads or lists the tree.
|
Package testlog keeps the framework's logs of a test process out of the test output and out of the package source tree, where log files changing with every run would make go's test cache rerun every test that reads or lists the tree. |
|
types
Package types defines the contracts between the framework and business projects: the Model, Service, Database, Selector, Cache, RBAC, and Logger interfaces, the query building blocks they exchange (Filter, Order, Cursor, Column, Term, Window), and the per-request ServiceContext.
|
Package types defines the contracts between the framework and business projects: the Model, Service, Database, Selector, Cache, RBAC, and Logger interfaces, the query building blocks they exchange (Filter, Order, Cursor, Column, Term, Window), and the per-request ServiceContext. |
|
urlquery
Package urlquery translates URL query parameters into the arguments the database layer builds a query from.
|
Package urlquery translates URL query parameters into the arguments the database layer builds a query from. |
|
Package leader runs, on one replica of a deployment at a time, the work a project registers: a loop that polls an external system, a relay that forwards an outbox, the one connection a protocol allows.
|
Package leader runs, on one replica of a deployment at a time, the work a project registers: a loop that polls an external system, a relay that forwards an outbox, the one connection a protocol allows. |
|
Package lock runs a piece of work once at a time across a deployment: an administrator's "rebuild the report", a refresh of a credential every replica shares, anything that must not run twice at once and is done when it returns.
|
Package lock runs a piece of work once at a time across a deployment: an administrator's "rebuild the report", a refresh of a credential every replica shares, anything that must not run twice at once and is done when it returns. |
|
Package logger holds the framework's log streams, one per component, and the loggers behind them: Init opens the streams the configuration names, and New builds a logger of its own for a component that has one.
|
Package logger holds the framework's log streams, one per component, and the loggers behind them: Init opens the streams the configuration names, and New builds a logger of its own for a component that has one. |
|
Package prommetrics provides Prometheus metrics for the application; the name avoids conflicting with standard library or common "metrics" package names.
|
Package prommetrics provides Prometheus metrics for the application; the name avoids conflicting with standard library or common "metrics" package names. |
|
Package middleware is the HTTP middleware a project mounts: Register adds middleware to every API route, RegisterAuth to the routes of the authenticated group, and the constructors here build the middleware the framework ships for either.
|
Package middleware is the HTTP middleware a project mounts: Register adds middleware to every API route, RegisterAuth to the routes of the authenticated group, and the constructors here build the middleware the framework ships for either. |
|
Package modelschema exposes the model column resolution used by the framework.
|
Package modelschema exposes the model column resolution used by the framework. |
|
Package module provides a unified module registration system that automatically registers models, services, and HTTP routes for CRUD operations.
|
Package module provides a unified module registration system that automatically registers models, services, and HTTP routes for CRUD operations. |
|
helloworld
Package helloworld is the complete module example projects are pointed to: one module on an empty model with request and response types of its own, and one on a table-backed model with before and after hooks for each action.
|
Package helloworld is the complete module example projects are pointed to: one module on an empty model with request and response types of its own, and one on a table-backed model with before and after hooks for each action. |
|
version
Package versionmod provides the version API module; the name avoids conflicting with the standard library "runtime/version" package.
|
Package versionmod provides the version API module; the name avoids conflicting with the standard library "runtime/version" package. |
|
Package otel provides OpenTelemetry tracing integration using OTLP exporters.
|
Package otel provides OpenTelemetry tracing integration using OTLP exporters. |
|
pkg
|
|
|
httpwrapper
Package httpwrapper provides JSON round-trip wrappers around *http.Request and *http.Response.
|
Package httpwrapper provides JSON round-trip wrappers around *http.Request and *http.Response. |
|
tunnel
Package tunnel is communication protocol between with server and user, server and client.
|
Package tunnel is communication protocol between with server and user, server and client. |
|
version
Package pkgversion provides version string helpers; the name avoids conflicting with the standard library "runtime/version" package.
|
Package pkgversion provides version string helpers; the name avoids conflicting with the standard library "runtime/version" package. |
|
provider
|
|
|
clickhouse
Package clickhouse provides the native ClickHouse client for analytical workloads: high-throughput batch ingestion and queries that bypass the gorm dialect.
|
Package clickhouse provides the native ClickHouse client for analytical workloads: high-throughput batch ingestion and queries that bypass the gorm dialect. |
|
Package redis holds the process-wide Redis client, the typed cache backend built on it, and the helpers that share its keyspace.
|
Package redis holds the process-wide Redis client, the typed cache backend built on it, and the helpers that share its keyspace. |
|
Package requestctx is the public entry to the request metadata that storage and service logs name a request by.
|
Package requestctx is the public entry to the request metadata that storage and service logs name a request by. |
|
Package response exposes the response entry points that code outside the framework's controller path needs: middleware, and the middleware a module ships to the projects that copy it.
|
Package response exposes the response entry points that code outside the framework's controller path needs: middleware, and the middleware a module ships to the projects that copy it. |
|
Package router registers a project's HTTP routes and the hooks that run once they are ready.
|
Package router registers a project's HTTP routes and the hooks that run once they are ready. |
|
Package service exposes the public service extension points for application code.
|
Package service exposes the public service extension points for application code. |
|
Package sse exposes the framework's Server-Sent Events support to application code.
|
Package sse exposes the framework's Server-Sent Events support to application code. |
|
Package tenant scopes a model's rows to the tenant the caller acts in.
|
Package tenant scopes a model's rows to the tenant the caller acts in. |
|
Package testutil is the test suite a gst project writes its tests against.
|
Package testutil is the test suite a gst project writes its tests against. |