graph

package
v1.5.106 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package graph is a Base's records as a typed GraphQL schema: one object type per collection, with its fields, its relations and the records that point at it; a filter input per collection whose operators per field type are the where clause's (core.CompileWhere); an orderBy; cursor connections with a total; aggregates; create, update, upsert and delete; and each record's history.

It has no transport and no second authorization. The schema is rendered from the Base's own collections, so it is per Base and changes with them, and every field is answered by a request on the Base's own router made as the caller: the record routes, the aggregate route and the history route, with their list and view rules, their tenancy and their rate limits, are the REST path's. zip's engine parses, binds variables and fragments, applies the bounds and the request's resolution budget, and projects each answer through its selection (zip.MountGraphFor). A host mounts it with the router it serves the Base with:

g := graph.New(app, router)
zipApp.MountGraphFor("/v1/base/graphql", g.Schema, g.Resolve)

There are no subscriptions: realtime is Base's own SSE stream, under the same rules, and a client refetches what changed by id.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph is one Base's records as GraphQL.

func New

func New(app core.App, router http.Handler) *Graph

New serves app's records, answering every field through router, the handler that serves app's REST routes.

func (*Graph) Resolve

func (g *Graph) Resolve(ctx context.Context, kind string, s zip.Selection) (any, error)

Resolve answers one root field of the graph, as zip's engine asks it.

func (*Graph) Schema

func (g *Graph) Schema(context.Context) (string, error)

Schema is the SDL of the Base's records as they stand.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL