basic

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](c ConfigIface, path ...string) (value T)

Types

type ConfigIface

type ConfigIface interface {
	Config() *seer.Query
}

ConfigIface is used in the ops for accessing the root of a resource

type ErrorWrapper

type ErrorWrapper func(format string, i ...any) error

ErrorWrapper is used to wrap "sync failed with %s" to "on application `name`; sync failed with"

type Getter

type Getter interface {
	Id() string
	Name() string
	Description() string
}

Getter represents the methods which are common to all resources

type Op

type Op func(ConfigIface) []*seer.Query

func Set

func Set(name string, value interface{}) Op

Set takes a value and a name to generate an Op for setting the values in config

func SetChild

func SetChild(parent string, name string, value interface{}) Op

type Resource

type Resource struct {
	ResourceIface

	Root   RootMethod
	Config RootMethod
	// contains filtered or unexported fields
}

Resource contains the default methods, they can be overridden on the resource itself or

func New

func New(seer *seer.Seer, iface ResourceIface, name string) (*Resource, error)

New returns a Basic which is embedded into a resource for generic methods

func NewNoName

func NewNoName(seer *seer.Seer, iface ResourceIface) (*Resource, error)

NewNoName like new returns a Basic which is embedded into a resource the only difference is no name is taken in the function or checked

func Yaml

func Yaml(data []byte) (*Resource, error)

func (Resource) Delete

func (r Resource) Delete(attributes ...string) (err error)

func (Resource) Set

func (r Resource) Set(sync bool, ops ...Op) (err error)

Set runs provided ops and writes the the config if sync is true, returns an error

type ResourceGetter

type ResourceGetter[T structureSpec.Structure] interface {
	Getter
	Tags() []string
	SmartOps() []string
	Application() string
	Struct() (T, error)
}

type ResourceIface

type ResourceIface interface {
	Name() string

	SetName(name string)
	AppName() string
	Directory() string
	Root() *seer.Query
	Config() *seer.Query
	WrapError(format string, i ...any) error
	Delete(attributes ...string) error
}

type RootMethod

type RootMethod func() *seer.Query

RootMethod returns a query for the root location of a resource

Jump to

Keyboard shortcuts

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