Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConfigUsedOutsideOfService = errRange.New( "Invalid call to config.Load[T]()", "A call to config.Load[T]() can only be made from within a service.", ) ErrConfigUsedInSubPackage = errRange.New( "Invalid call to config.Load[T]()", "A call to config.Load[T]() can only be made from the top level package of a service.", ) ErrCrossServiceConfigUse = errRange.New( "Cross service config use", "A config instance can only be referenced from within the service that the call to `config.Load[T]()` was made in.", ) )
View Source
var LoadParser = &resourceparser.Parser{ Name: "ConfigLoad", InterestingImports: []paths.Pkg{"encore.dev/config"}, Run: func(p *resourceparser.Pass) { name := pkginfo.QualifiedName{PkgPath: "encore.dev/config", Name: "Load"} spec := &parseutil.ReferenceSpec{ MinTypeArgs: 0, MaxTypeArgs: 1, Parse: parseLoad, } parseutil.FindPkgNameRefs(p.Pkg, []pkginfo.QualifiedName{name}, func(file *pkginfo.File, name pkginfo.QualifiedName, stack []ast.Node) { parseutil.ParseReference(p, spec, parseutil.ReferenceData{ File: file, Stack: stack, ResourceFunc: name, }) }) }, }
Functions ¶
func ResolveConfigUsage ¶
func ResolveConfigUsage(data usage.ResolveData, load *Load) usage.Usage
Types ¶
type Load ¶
type Load struct { AST *ast.CallExpr File *pkginfo.File // Type is the type of the config struct being loaded. // It's guaranteed to be a (possibly pointer to a) named struct type. Type schema.Type // FuncCall is the AST node that represents the config.Load expression. FuncCall *ast.CallExpr }
Load represents a config load statement.
type ReferenceUsage ¶
Click to show internal directories.
Click to hide internal directories.