scriptpending

package
v1.146.2 Latest Latest
Warning

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

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

Documentation

Overview

Package scriptpending keeps a managed-script create the save gate refused (#2114): its source and the rest of what the create named, one per owner and name, so the author fixes a failing test or a lint finding with a small patch rather than sending a 45 KB script again. A successful save of the name removes it, and the next refused create of the same name replaces it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Notice

func Notice(name string) string

Notice is what a refusal says when its source was kept.

Types

type Create

type Create struct {
	Name        string         `json:"name"`
	DisplayName string         `json:"display_name,omitempty"`
	Description string         `json:"description,omitempty"`
	Category    *string        `json:"category,omitempty"`
	Params      []script.Param `json:"params,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
	Source      string         `json:"-"`
	UpdatedAt   time.Time      `json:"-"`
}

Create is a refused create as its author sent it.

func (*Create) Fields

func (c *Create) Fields() map[string]any

Fields renders a pending create as manage_script get answers it.

type Postgres

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

Postgres keeps them in script_pending_creates.

func NewPostgres

func NewPostgres(db *sql.DB) *Postgres

NewPostgres returns the store over db, or nil without one.

func (*Postgres) Delete

func (p *Postgres) Delete(ctx context.Context, owner, name string) error

Delete implements Store.

func (*Postgres) Get

func (p *Postgres) Get(ctx context.Context, owner, name string) (*Create, error)

Get implements Store.

func (*Postgres) Put

func (p *Postgres) Put(ctx context.Context, owner string, c Create) error

Put implements Store.

type Store

type Store interface {
	// Put keeps c as the owner's pending create of its name, replacing one.
	Put(ctx context.Context, owner string, c Create) error
	// Get returns the owner's pending create of name, or nil when none is kept.
	Get(ctx context.Context, owner, name string) (*Create, error)
	// Delete removes the owner's pending create of name, if any.
	Delete(ctx context.Context, owner, name string) error
}

Store keeps the refused creates.

Jump to

Keyboard shortcuts

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