Documentation
¶
Index ¶
- Constants
- func ValidateConstructorType(s Service) error
- func ValidateDecoratorArgs(d Decorator) error
- func ValidateDecoratorMethod(d Decorator) error
- func ValidateDecoratorTag(d Decorator) error
- func ValidateDecorators(i Input) error
- func ValidateMeta(i Input) error
- func ValidateMetaContainerConstructor(m Meta) error
- func ValidateMetaContainerType(m Meta) error
- func ValidateMetaFunctions(m Meta) error
- func ValidateMetaImports(m Meta) error
- func ValidateMetaPkg(m Meta) error
- func ValidateParams(i Input) error
- func ValidateServiceArgs(s Service) error
- func ValidateServiceCalls(s Service) error
- func ValidateServiceConstructor(s Service) error
- func ValidateServiceFields(s Service) error
- func ValidateServiceGetter(s Service) error
- func ValidateServiceName(n string) error
- func ValidateServiceTags(s Service) error
- func ValidateServiceType(s Service) error
- func ValidateServiceValue(s Service) error
- func ValidateServices(i Input) error
- type Call
- type Decorator
- type Input
- type Meta
- type Scope
- type Service
- type Tag
- type ValidateFn
- type ValidateService
- type Validator
- type Version
- type VersionValidator
Constants ¶
View Source
const (
DefaultServiceTodo = false
)
Variables ¶
This section is empty.
Functions ¶
func ValidateConstructorType ¶
ValidateConstructorType validates whether the given service has a proper constructor. To initialize a service, it must have either a valid constructor or a value.
func ValidateDecoratorArgs ¶
func ValidateDecoratorMethod ¶
func ValidateDecoratorTag ¶
func ValidateDecorators ¶
func ValidateMeta ¶
func ValidateMetaFunctions ¶
func ValidateMetaImports ¶
func ValidateMetaPkg ¶
func ValidateParams ¶
func ValidateServiceArgs ¶
func ValidateServiceCalls ¶
func ValidateServiceFields ¶
func ValidateServiceGetter ¶
func ValidateServiceName ¶
func ValidateServiceTags ¶
func ValidateServiceType ¶
func ValidateServiceValue ¶
func ValidateServices ¶
Types ¶
type Call ¶
func (*Call) UnmarshalYAML ¶
type Input ¶
type Meta ¶
type Meta struct { Pkg *string `yaml:"pkg"` // default "main" ContainerType *string `yaml:"container_type"` // default "Gontainer" ContainerConstructor *string `yaml:"container_constructor"` // default "NewGontainer" DefaultScope *Scope `yaml:"default_scope"` // default "shared", it's a default scope for services, equal to one of the following: "shared", "contextual", "non_shared" DefaultMustGetter *bool `yaml:"default_must_getter"` // default false Imports map[string]string `yaml:"imports"` // {"alias": "my/long/path", ...} Functions map[string]string `yaml:"functions"` // {"env": "os.Getenv", ...} }
type Service ¶
type Service struct { Getter *string `yaml:"getter"` // e.g. GetDB MustGetter *bool `yaml:"must_getter"` // if true adds MustGet func, it requires non-empty Getter Type *string `yaml:"type"` // *?my/import/path.Type Value *string `yaml:"value"` // my/import/path.Variable Constructor *string `yaml:"constructor"` // NewDB Args []any `yaml:"arguments"` // ["%host%", "%port%", "@logger"] Calls []Call `yaml:"calls"` // [["SetLogger", ["@logger"]], ...] Fields map[string]any `yaml:"fields"` // Field: "%value%" Tags []Tag `yaml:"tags"` // ["service_decorator", ...] Scope *Scope `yaml:"scope"` // scope for the service, if nil, default value will be applied Todo *bool `yaml:"todo"` // if true skips validation and returns error whenever users asks container for a service }
type Tag ¶
func (*Tag) UnmarshalYAML ¶
type ValidateFn ¶
func DefaultDecoratorsValidators ¶
func DefaultDecoratorsValidators() []ValidateFn
DefaultDecoratorsValidators returns validators for Input.Decorators.
func DefaultMetaValidators ¶
func DefaultMetaValidators() []ValidateFn
DefaultMetaValidators returns validators for Input.Meta.
func DefaultParamsValidators ¶
func DefaultParamsValidators() []ValidateFn
DefaultParamsValidators returns validators for Input.Params.
func DefaultServicesValidators ¶
func DefaultServicesValidators() []ValidateFn
DefaultServicesValidators returns validators for Input.Services.
func DefaultVersionValidators ¶ added in v0.2.4
func DefaultVersionValidators(version string) []ValidateFn
DefaultVersionValidators returns validators for Input.Version.
type ValidateService ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewDefaultValidator ¶
NewDefaultValidator expects a version that follows semver schema without the leading "v".
func NewValidator ¶
func NewValidator(validators ...ValidateFn) *Validator
type Version ¶ added in v0.0.27
type Version string
func (*Version) UnmarshalYAML ¶ added in v0.0.27
type VersionValidator ¶ added in v0.2.4
type VersionValidator struct {
// contains filtered or unexported fields
}
func NewVersionValidator ¶ added in v0.2.4
func NewVersionValidator(version string) *VersionValidator
NewVersionValidator expects a proper version without the leading "v".
func (*VersionValidator) ValidateVersion ¶ added in v0.2.4
func (v *VersionValidator) ValidateVersion(i Input) (err error)
Click to show internal directories.
Click to hide internal directories.