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

base

package
v2.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiResponse

type ApiResponse[T any] struct {
	Success            bool                 `json:"success" doc:"Whether the request was successful"`
	Data               T                    `json:"data" doc:"Response data"`
	FailedEnvironments []EnvironmentFailure `json:"failedEnvironments,omitempty" doc:"Environments whose results are missing from a multi-environment response"`
}

ApiResponse is a generic wrapper for API responses.

type EnvironmentFailure added in v2.16.1

type EnvironmentFailure struct {
	Environment EnvironmentRef `json:"environment" doc:"Environment that failed"`
	Message     string         `json:"message" doc:"Why the environment's results are missing"`
}

type EnvironmentRef added in v2.16.1

type EnvironmentRef struct {
	ID   string `json:"id" doc:"Environment ID"`
	Name string `json:"name" doc:"Environment display name"`
}

type EnvironmentTag added in v2.16.1

type EnvironmentTag struct {
	EnvironmentID   string `json:"environmentId,omitempty" doc:"Environment the row came from in a multi-environment list"`
	EnvironmentName string `json:"environmentName,omitempty" doc:"Display name of the environment the row came from"`
}

func (EnvironmentTag) Environment added in v2.16.1

func (t EnvironmentTag) Environment() EnvironmentRef

func (*EnvironmentTag) SetEnvironment added in v2.16.1

func (t *EnvironmentTag) SetEnvironment(ref EnvironmentRef)

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error" doc:"Error message describing what went wrong"`
}

ErrorResponse represents an error response.

type FieldError added in v2.15.0

type FieldError struct {
	Field string
	Err   error
}

FieldError identifies the input field associated with an error.

func (*FieldError) Error added in v2.15.0

func (e *FieldError) Error() string

func (*FieldError) Unwrap added in v2.15.0

func (e *FieldError) Unwrap() error

type JsonObject

type JsonObject map[string]any

JsonObject is a map-based representation of a JSON object that can be stored in a database. It implements the sql.Valuer and sql.Scanner interfaces for seamless database integration.

func (*JsonObject) Scan

func (j *JsonObject) Scan(value any) error

Scan implements the sql.Scanner interface for database retrieval. It unmarshals JSON data from the database into the JsonObject. Supports scanning from []byte or string values. If the value is nil, the JsonObject is set to nil.

func (JsonObject) Value

func (j JsonObject) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database storage. It marshals the JsonObject to JSON bytes for database insertion. If the JsonObject is nil, it returns nil.

type MessageResponse

type MessageResponse struct {
	Message    string  `json:"message" doc:"Response message"`
	ActivityID *string `json:"activityId,omitempty" doc:"Background activity ID tracking this action"`
}

MessageResponse represents a simple message response.

type Paginated

type Paginated[T any] struct {
	Success            bool                 `json:"success" doc:"Whether the request was successful"`
	Data               []T                  `json:"data" doc:"Array of items for the current page"`
	Pagination         PaginationResponse   `json:"pagination" doc:"Pagination metadata"`
	FailedEnvironments []EnvironmentFailure `json:"failedEnvironments,omitempty" doc:"Environments whose results are missing from a multi-environment response"`
}

Paginated is a generic wrapper for paginated responses.

type PaginatedWithCounts added in v2.6.0

type PaginatedWithCounts[T, C any] struct {
	Success            bool                 `json:"success" doc:"Whether the request was successful"`
	Data               []T                  `json:"data" doc:"Array of items for the current page"`
	Counts             C                    `json:"counts" doc:"Aggregate counts for the filtered collection"`
	Pagination         PaginationResponse   `json:"pagination" doc:"Pagination metadata"`
	FailedEnvironments []EnvironmentFailure `json:"failedEnvironments,omitempty" doc:"Environments whose results are missing from a multi-environment response"`
}

PaginatedWithCounts is a generic wrapper for paginated responses with aggregate counts.

type PaginatedWithWarnings added in v2.16.0

type PaginatedWithWarnings[T any] struct {
	Success    bool               `json:"success"`
	Data       []T                `json:"data"`
	Pagination PaginationResponse `json:"pagination"`
	Warnings   []string           `json:"warnings,omitempty"`
}

PaginatedWithWarnings is a generic wrapper for paginated responses with warnings.

type PaginationResponse

type PaginationResponse struct {
	TotalPages      int64 `json:"totalPages" doc:"Total number of pages"`
	TotalItems      int64 `json:"totalItems" doc:"Total number of items in the current filtered set"`
	CurrentPage     int   `json:"currentPage" doc:"Current page number (1-indexed)"`
	ItemsPerPage    int   `json:"itemsPerPage" doc:"Number of items per page"`
	GrandTotalItems int64 `json:"grandTotalItems,omitempty" doc:"Total number of items without filters"`
}

PaginationResponse contains pagination metadata.

Jump to

Keyboard shortcuts

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