service

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Driver string
	Name   string
	Source string
	Pool   PoolConfig
}

Connection represents a relational database or connection pool declaration.

func (Connection) Key

func (c Connection) Key() string

Key returns the short identifier for the pool (e.g., "postgres.primary").

func (Connection) Reference

func (c Connection) Reference() string

Reference returns the full manifest reference path (e.g., "connection.postgres.primary").

type Contact

type Contact struct {
	Name  string
	Email string
	URL   string
}

Contact captures API maintainer contact information.

type Definition

type Definition struct {
	Server      Server
	OpenAPI     OpenAPI
	Problem     Problem
	Connections []Connection
	Schemas     map[string]Schema
	Endpoints   []Endpoint
}

Definition represents the verified, immutable runtime specification for an API service.

func Build

func Build(m *manifest.Manifest, evalCtx *hcl.EvalContext) (*Definition, error)

Build lowers a raw HCL Manifest into an immutable, fully validated service definition.

type Endpoint

type Endpoint struct {
	Method       string
	Path         string
	RoutePattern string
	Description  string
	RequestRules RequestRules
	Handler      Handler
}

Endpoint represents an HTTP route with ingress rules and a terminal handler.

type Field

type Field struct {
	Name        string
	Type        string
	Required    bool
	Default     any
	Description string
	Enum        []any
	Format      string
	Pattern     string
	MinLength   *int
	MaxLength   *int
	Min         *float64
	Max         *float64
	MinItems    *int
	MaxItems    *int
	UniqueItems bool
}

Field defines validation rules and bounds for an input property.

type GoStep

type GoStep struct {
	Use  string
	Args hcl.Expression
}

GoStep defines invocation parameters for a native Go callback function.

type Handler

type Handler interface {
	// contains filtered or unexported methods
}

Handler is a sealed interface guaranteed to be either PipelineHandler or OpenAPIHandler.

type License

type License struct {
	Name string
	URL  string
}

License captures API licensing information.

type OpenAPI

type OpenAPI struct {
	Title       string
	Version     string
	Description string
	Servers     []OpenAPIServer
	Tags        []OpenAPITag
	Contact     *Contact
	License     *License
}

OpenAPI holds document metadata for OpenAPI 3.1 specification generation.

type OpenAPIHandler

type OpenAPIHandler struct {
	Mode        string
	Format      string
	Renderer    string
	SpecURL     string
	Template    string
	Title       string
	Version     string
	Description string
}

OpenAPIHandler represents an endpoint serving specifications or documentation UIs.

type OpenAPIServer

type OpenAPIServer struct {
	URL         string
	Description string
}

OpenAPIServer defines a target deployment host in the specification.

type OpenAPITag

type OpenAPITag struct {
	Name        string
	Description string
}

OpenAPITag defines an operation category tag.

type PipelineHandler

type PipelineHandler struct {
	Steps []Step
}

PipelineHandler represents an endpoint executed through sequential pipeline steps.

type PoolConfig

type PoolConfig struct {
	MaxOpen     int
	MaxIdle     int
	MaxLifetime time.Duration
	IdleTimeout time.Duration
}

PoolConfig defines sizing and lifecycle limits for a connection pool.

type Problem

type Problem struct {
	TypePrefix string
}

Problem configures RFC 9457 Problem Details error type URI formatting.

func (Problem) FormatType

func (p Problem) FormatType(slug string) string

FormatType returns the fully qualified error type URI for a given slug.

type RequestRules

type RequestRules struct {
	PathFields   []Field
	QueryFields  []Field
	HeaderFields []Field
	BodyFields   []Field
}

RequestRules holds verified field validation constraints for an endpoint.

type RespondStep

type RespondStep struct {
	Condition hcl.Expression
	Status    hcl.Expression
	Headers   hcl.Expression
	Body      hcl.Expression
}

RespondStep defines the status code, headers, and body to return to the HTTP client.

type SQLCatch

type SQLCatch struct {
	Code    string
	Status  hcl.Expression
	Headers hcl.Expression
	Body    hcl.Expression
}

SQLCatch defines response mapping when a database query raises a specific error code.

type SQLStep

type SQLStep struct {
	ConnectionKey string
	Query         string
	Args          hcl.Expression
	Catches       []SQLCatch
}

SQLStep defines a parameterized database query with constraint catch blocks.

type Schema

type Schema struct {
	Name        string
	Description string
	Fields      []Field
}

Schema represents a reusable request payload schema.

type Server

type Server struct {
	Host         string
	Port         int
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration
	MaxBodySize  int64
}

Server defines transport-level listener and socket settings.

type StarlarkStep

type StarlarkStep struct {
	Source string
}

StarlarkStep defines source code for an embedded Starlark transformation.

type Step

type Step struct {
	Type     StepType
	Name     string
	Go       *GoStep
	Starlark *StarlarkStep
	SQL      *SQLStep
	Respond  *RespondStep
}

Step represents a configured step ready for execution within a pipeline.

type StepType

type StepType string

StepType defines the execution category for a pipeline step.

const (
	StepTypeGo       StepType = "go"
	StepTypeStarlark StepType = "starlark"
	StepTypeSQL      StepType = "sql"
	StepTypeRespond  StepType = "respond"
)

StepType constants for supported step types.

Jump to

Keyboard shortcuts

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