bass

package module
v0.0.0-...-e542c28 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

README

BASS

Backend as Super Service

Check Status Go Report Card Codecov Go Reference License

Running actions locally

Run lint job:

act -j lint --container-architecture linux/amd64 -P ubuntu-24.04=-self-hosted -s GITHUB_TOKEN="$(gh auth token)"

for other jobs you can do the same.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

func NewHandler

func NewHandler(resourcesRepo ResourcesRepository) *Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ListMetadata

type ListMetadata struct {
	PackageName  string `json:"packageName"`
	APIVersion   string `json:"apiVersion"`
	ResourceType string `json:"resourceType"`
}

type MemRepo

type MemRepo struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMemRepo

func NewMemRepo() *MemRepo

func (*MemRepo) Create

func (repo *MemRepo) Create(_ context.Context, item *Resource) error

func (*MemRepo) Delete

func (repo *MemRepo) Delete(_ context.Context, packageName, resourceType, name string) error

func (*MemRepo) Get

func (repo *MemRepo) Get(_ context.Context, packageName, resourceType, name string) (*Resource, error)

func (*MemRepo) List

func (repo *MemRepo) List(_ context.Context, packageName, apiVersion, resourceType string) (ResourceList, error)

func (*MemRepo) Update

func (repo *MemRepo) Update(_ context.Context, item *Resource) error

type Metadata

type Metadata struct {
	UID          string    `json:"uid"`
	PackageName  string    `json:"packageName"`
	APIVersion   string    `json:"apiVersion"`
	ResourceType string    `json:"resourceType"`
	Name         string    `json:"name"`
	CreatedAt    time.Time `json:"createdAt"`
	UpdatedAt    time.Time `json:"updatedAt"`
}

type Package

type Package struct {
	Metadata Metadata `json:"metadata"`
}

type Resource

type Resource struct {
	Metadata   Metadata       `json:"metadata"`
	Properties map[string]any `json:",inline"`
}

type ResourceExistsError

type ResourceExistsError struct {
	PackageName  string
	ResourceType string
	Name         string
}

func (ResourceExistsError) Error

func (err ResourceExistsError) Error() string

type ResourceList

type ResourceList struct {
	Metadata ListMetadata `json:"metadata"`
	Items    []*Resource  `json:"items"`
}

type ResourceNotFoundError

type ResourceNotFoundError struct {
	PackageName  string
	ResourceType string
	Name         string
}

func (ResourceNotFoundError) Error

func (err ResourceNotFoundError) Error() string

type ResourceTypeDefinition

type ResourceTypeDefinition struct {
	Metadata     Metadata                        `json:"metadata"`
	Package      string                          `json:"package"`
	Versions     []ResourceTypeDefinitionVersion `json:"versions"`
	ResourceType string                          `json:"resourceType"`
	Plural       string                          `json:"plural"`
}

type ResourceTypeDefinitionNotFoundError

type ResourceTypeDefinitionNotFoundError struct {
	PackageName        string
	ResourceTypePlural string
}

func (ResourceTypeDefinitionNotFoundError) Error

type ResourceTypeDefinitionVersion

type ResourceTypeDefinitionVersion struct {
	Name   string         `json:"name"`
	Schema map[string]any `json:"schema"`
}

type ResourcesRepository

type ResourcesRepository interface {
	List(ctx context.Context, packageName, apiVersion, resourceType string) (list ResourceList, err error)
	Create(ctx context.Context, item *Resource) (err error)
	Get(ctx context.Context, packageName, resourceType, name string) (item *Resource, err error)
	Update(ctx context.Context, item *Resource) (err error)
	Delete(ctx context.Context, packageName, resourceTypePlural, name string) (err error)
}

Directories

Path Synopsis
cmd
bass command

Jump to

Keyboard shortcuts

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