Help us shape the future of Go! Take the 2026 Go Developer Survey

scriptlist

package
v1.152.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package scriptlist is what the scripts listing is narrowed and ordered by.

It holds the query string half of GET /portal/scripts: the scope that decides which scripts a caller is asking about, the axes that narrow whatever that scope selected, and the ordering the store applies ahead of the page cap (#1795). It takes the caller as an address and a flag rather than as the HTTP layer's identity type, so it can be read and tested without the handler and cannot import it back.

Index

Constants

View Source
const (
	KindScript  = "script"
	KindLibrary = "library"
)

The kinds the listing narrows to with kind=, in the words of the listing's Kind column (#1970): a script is the kind that runs, a library the kind other scripts load.

View Source
const (
	EndpointBound   = "bound"
	EndpointUnbound = "unbound"
)

The values endpoint= narrows to (#2259): the scripts bound to an endpoint, and the ones that are not.

View Source
const ScopeMine = "mine"

ScopeMine is the scope value that narrows a listing to the caller's own scripts.

Variables

This section is empty.

Functions

func Endpoints added in v1.152.0

func Endpoints(
	ctx context.Context, list func(context.Context, epbinding.Filter) ([]epbinding.Binding, int, error), ids []string,
) map[string]*Endpoint

Endpoints is the endpoint each script ids names is bound to, by script id, read with list in one call whose limit is the number of scripts, so no bound one is cut off. A script bound to none is absent, and so is every script when the read fails: a listing that cannot report an endpoint is still a listing.

func Filter

func Filter(owner string, isAdmin bool, query url.Values) script.ListFilter

Filter turns the query string into the listing's predicate and its ordering.

Two different things meet here and are kept apart. The SCOPE decides which scripts the caller is asking about -- every script by default, their own with scope=mine (#1994), and every script unconditionally for an administrator. The NARROWING axes (category and tag, #1369; free text, #1405; author, status and enabled, #1795) narrow whatever that scope selected, and apply to an administrator exactly as they do to everybody else, because they narrow what a reader asked for rather than what they are entitled to. Every one of them runs in the store, so each covers every script the scope admits rather than the page of them a listing happens to hold.

The ORDERING is carried through for the same reason: the store applies the page cap, so a column sorted anywhere else would sort the page.

A nil query names no axis, which is how a caller asks for the scope alone.

func ParseEndpoint added in v1.152.0

func ParseEndpoint(v string) (bound, named bool, err error)

ParseEndpoint reads endpoint=: whether it names the bound scripts, and whether it names either (an absent value lists both), or an error for a value that names neither.

func ParseKind added in v1.138.1

func ParseKind(v string) (library, named bool, err error)

ParseKind reads kind=: whether it names libraries, and whether it names a kind at all (an absent value lists both), or an error for a value that names no kind.

Types

type Endpoint added in v1.152.0

type Endpoint struct {
	Name string `json:"name" example:"order-lookup"`
	// Path is the address it answers at, with the template's parameters in
	// braces.
	Path     string `json:"path" example:"/endpoints/order-lookup/{id}"`
	AuthMode string `json:"auth_mode" example:"authenticated"`
	Enabled  bool   `json:"enabled" example:"true"`
}

Endpoint is a listed script's endpoint (#2314): where it answers, who it admits and whether it is on. The binding's limits and callers are read on the script's own page.

Jump to

Keyboard shortcuts

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