Documentation
¶
Index ¶
- func CleanDir(dirPath string, exclusions StringSet) error
- func ExpandShortEnumName(name string) string
- func FilterExamples(description string, lang string) string
- func IsNOptionalInput(t schema.Type) bool
- func IsProvideDefaultsFuncRequired(t schema.Type) bool
- func MapInnerType(t schema.Type, f func(schema.Type) schema.Type) schema.Type
- func MapOptionalType(t schema.Type, f func(schema.Type) schema.Type) schema.Type
- func OptionalType(p *schema.Property) schema.Type
- func PackageReferences(pkg *schema.Package) []schema.PackageReference
- func PkgEquals(p1, p2 schema.PackageReference) bool
- func PlainType(t schema.Type) schema.Type
- func RequiredType(p *schema.Property) schema.Type
- func ResolvedType(t schema.Type) schema.Type
- func SimplifyInputUnion(t schema.Type) schema.Type
- func SortedKeys[T any](m map[string]T) []string
- func UnwrapType(t schema.Type) schema.Type
- func VisitType(schemaType schema.Type, visitor func(t schema.Type))
- func VisitTypeClosure(properties []*schema.Property, visitor func(t schema.Type))
- type DocLanguageHelper
- type Fs
- type Set
- type StringSet
- func (ss StringSet) Add(s string)
- func (ss StringSet) Any() bool
- func (ss StringSet) Contains(subset StringSet) bool
- func (ss StringSet) Delete(s string)
- func (ss StringSet) Except(s string) StringSet
- func (ss StringSet) Has(s string) bool
- func (ss StringSet) SortedValues() []string
- func (ss StringSet) Subtract(other StringSet) StringSet
- func (ss StringSet) Union(other StringSet) StringSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanDir ¶
CleanDir removes all existing files from a directory except those in the exclusions list. Note: The exclusions currently don't function recursively, so you cannot exclude a single file in a subdirectory, only entire subdirectories. This function will need improvements to be able to target that use-case.
func ExpandShortEnumName ¶
func FilterExamples ¶
FilterExamples filters the code snippets in a schema docstring to include only those that target the given language.
func IsNOptionalInput ¶
func IsProvideDefaultsFuncRequired ¶
If a helper function needs to be invoked to provide default values for a plain type. The provided map cannot be reused.
func MapInnerType ¶
MapInnerType applies f to the first non-wrapper type in t. MapInnerType does not mutate it's input, and t should not either.
func MapOptionalType ¶
Applies f to the first non-optional type in t. If t is Optional{v} then returns Optional{f(v)}, otherwise f(t) is returned
func OptionalType ¶
OptionalType wraps the Property's type in an OptionalType if it is not already optional.
func PackageReferences ¶
func PackageReferences(pkg *schema.Package) []schema.PackageReference
PackageReferences returns a list of packages that are referenced by the given package.
func PkgEquals ¶
func PkgEquals(p1, p2 schema.PackageReference) bool
Check if two packages are the same.
func PlainType ¶
PlainType deeply removes any InputTypes from t, with the exception of argument structs. Use ResolvedType to unwrap argument structs as well.
func RequiredType ¶
RequiredType unwraps the OptionalType enclosing the Property's type, if any.
func ResolvedType ¶
ResolvedType deeply removes any InputTypes from t.
func SortedKeys ¶
SortedKeys returns a sorted list of keys for the given map.
func UnwrapType ¶
UnwrapType removes any outer OptionalTypes and InputTypes from t.
Types ¶
type DocLanguageHelper ¶
type DocLanguageHelper interface { GetPropertyName(p *schema.Property) (string, error) GetEnumName(e *schema.Enum, typeName string) (string, error) GetDocLinkForResourceType(pkg *schema.Package, moduleName, typeName string) string GetDocLinkForCodeinfraType(pkg *schema.Package, typeName string) string GetDocLinkForResourceInputOrOutputType(pkg *schema.Package, moduleName, typeName string, input bool) string GetDocLinkForFunctionInputOrOutputType(pkg *schema.Package, moduleName, typeName string, input bool) string GetLanguageTypeString(pkg *schema.Package, moduleName string, t schema.Type, input bool) string GetFunctionName(modName string, f *schema.Function) string // GetResourceFunctionResultName returns the name of the result type when a static resource function is used to lookup // an existing resource. GetResourceFunctionResultName(modName string, f *schema.Function) string GetMethodName(m *schema.Method) string GetMethodResultName(pkg *schema.Package, modName string, r *schema.Resource, m *schema.Method) string // GetModuleDocLink returns the display name and the link for a module (including root modules) in a given package. GetModuleDocLink(pkg *schema.Package, modName string) (string, string) }
DocLanguageHelper is an interface for extracting language-specific information from a Codeinfra schema. See the implementation for this interface under each of the language code generators.
type StringSet ¶
type StringSet map[string]struct{}
func NewStringSet ¶
func (StringSet) Contains ¶
Contains returns true if all elements of the subset are also present in the current set. It also returns true if subset is empty.
func (StringSet) SortedValues ¶
Directories
¶
Path | Synopsis |
---|---|
package cgstrings has various string processing functions that are useful during code generation.
|
package cgstrings has various string processing functions that are useful during code generation. |
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
|
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning. |
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
|
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning. |
hcl2
|
|
model/pretty
pretty is an extensible utility library to pretty-print nested structures.
|
pretty is an extensible utility library to pretty-print nested structures. |
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
|
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning. |
tstypes
Helper code to assist emitting correctly minimally parenthesized TypeScript type literals.
|
Helper code to assist emitting correctly minimally parenthesized TypeScript type literals. |
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
|
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning. |
testing
|
|