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

profiles

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaContentType = "application/schema+json"

Variables

This section is empty.

Functions

func Import

func Import(ctx context.Context, source Store, target *DBStore) error

func IsReservedParam

func IsReservedParam(key string) bool

reservedParam reports whether a query-string key is a transport concern (paging, format, content-negotiation) rather than a profile filter param.

func WantsSchema

func WantsSchema(r *http.Request) bool

Types

type BodyDecoder

type BodyDecoder func(context.Context, map[string]any) (map[string]any, error)

type ContextProvider

type ContextProvider func() dbcontext.Context

type DBStore

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

func NewDBStore

func NewDBStore(db *gorm.DB) (*DBStore, error)

func (*DBStore) Delete

func (s *DBStore) Delete(ctx context.Context, name string) error

func (*DBStore) Get

func (s *DBStore) Get(ctx context.Context, name string) (query.Profile, error)

func (*DBStore) List

func (s *DBStore) List(ctx context.Context) ([]query.Profile, error)

func (*DBStore) Save

func (s *DBStore) Save(ctx context.Context, profile query.Profile) error

type FileStore

type FileStore struct{ Dir string }

func NewFileStore

func NewFileStore(dir string) (*FileStore, error)

func (*FileStore) Delete

func (s *FileStore) Delete(_ context.Context, name string) error

func (*FileStore) Get

func (s *FileStore) Get(ctx context.Context, name string) (query.Profile, error)

func (*FileStore) List

func (s *FileStore) List(context.Context) ([]query.Profile, error)

func (*FileStore) Save

func (s *FileStore) Save(_ context.Context, profile query.Profile) error

type Options

type Options struct {
	Store      StoreProvider
	Context    ContextProvider
	DecodeBody BodyDecoder
}

type ResolvedProfile added in v0.1.23

type ResolvedProfile struct {
	Profile           query.Profile
	ConnectionProfile string
}

func Resolve added in v0.1.23

func Resolve(ctx context.Context, store Store, name string) (ResolvedProfile, error)

type Service

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

func New

func New(options Options) (*Service, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, name string) error

func (*Service) Get

func (s *Service) Get(ctx context.Context, name string) (query.Profile, error)

func (*Service) Handler

func (s *Service) Handler(prefix string, next http.Handler) (http.Handler, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]query.Profile, error)

func (*Service) OpenAPIHandler

func (s *Service) OpenAPIHandler(root *cobra.Command, config *rpc.Config) (http.Handler, error)

func (*Service) RegisterClicky

func (s *Service) RegisterClicky()

registerProfileEntity registers the YAML-backed profile entity with list + full CRUD on the CLI and over HTTP. Create/Update use the context-aware handlers so the nested profile body (provider/params/columns) survives via rpc.RequestFromContext instead of the executor's flag-flattening. Execution (GET /{name}?params) is served by execHandler and schemas by schemaHandler.

func (*Service) RegisterDynamic

func (s *Service) RegisterDynamic(ctx context.Context) error

registerProfileEntities registers one clicky dynamic entity per stored profile so each profile appears as its own sidebar surface (with a provider-derived icon) and is executable: the entity's List runs the profile and returns its rows. Entities are snapshotted at startup; a newly created profile needs a restart to appear as its own surface (it still executes via execHandler and shows in the aggregate list until then).

func (*Service) Save

func (s *Service) Save(ctx context.Context, body map[string]any, id string) (query.Profile, error)

saveProfile decodes the (nested) request body into a Profile and persists it. On update, a path id supplies the profile name when the body omits it.

type Store

type StoreProvider

type StoreProvider func() (Store, error)

Jump to

Keyboard shortcuts

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