Documentation ¶
Index ¶
- Variables
- func AdditionalStandardImports(fields []Field) []string
- func BuildTemplateFuncMap(funcs ...any) template.FuncMap
- func CamelToWords(camel string) string
- func ColumnOutput(columnWidth int, columns ...string) string
- func FirstLetter(in string) string
- func FirstLetterLowercase(in string) string
- func IsLastItem(itemIdx int, collectionLength int) bool
- func RunMapper(mapper Mapper, in ...string) string
- func SnakeCase(name string) string
- func SnakeCaseToCamel(snake string) string
- func ToSnakeCase(str string) string
- func TypeWithoutPointer(t string) string
- func WriteCodeToFile(buffer *bytes.Buffer, fileName string) error
- type Field
- type GenerationModel
- type Generator
- type Mapper
- type ObjectNameProvider
- type ResourceSchemaDetails
- type SchemaAttribute
- type SdkObjectDetails
- type StructDetails
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Identity = func(field string) string { return field } ToString = func(field string) string { return fmt.Sprintf("%s.String()", field) } FullyQualifiedName = func(field string) string { return fmt.Sprintf("%s.FullyQualifiedName()", field) } Name = func(field string) string { return fmt.Sprintf("%s.Name()", field) } CastToString = func(field string) string { return fmt.Sprintf("string(%s)", field) } CastToInt = func(field string) string { return fmt.Sprintf("int(%s)", field) } )
Functions ¶
func BuildTemplateFuncMap ¶
func CamelToWords ¶
func ColumnOutput ¶
ColumnOutput is a helper to align a tabular output with the given columnWidth, e.g. (for 20 spaces column width): Name string string State sdk.WarehouseState string
func FirstLetter ¶
func FirstLetterLowercase ¶
func IsLastItem ¶
func SnakeCaseToCamel ¶
func ToSnakeCase ¶
ToSnakeCase allows converting a CamelCase text to camel_case one (needed for schema attribute names). Examples: - CamelCase -> camel_case - ACamelCase -> a_camel_case - URLParser -> url_parser - Camel1Case -> camel1_case - camelCase -> camel_case - camelURL -> camel_url - camelURLSomething -> camel_url_something
func TypeWithoutPointer ¶
Types ¶
type GenerationModel ¶
type GenerationModel interface {
SomeFunc()
}
TODO [SNOW-1501905]: describe TODO [SNOW-1501905]: better func
type Generator ¶
type Generator[T ObjectNameProvider, M GenerationModel] struct { // contains filtered or unexported fields }
func NewGenerator ¶
func NewGenerator[T ObjectNameProvider, M GenerationModel](objectsProvider func() []T, modelProvider func(T) M, filenameProvider func(T, M) string, templates []*template.Template) *Generator[T, M]
func (*Generator[_, _]) RunAndHandleOsReturn ¶
func (g *Generator[_, _]) RunAndHandleOsReturn()
func (*Generator[T, M]) WithAdditionalObjectsDebugLogs ¶
func (*Generator[T, M]) WithObjectFilter ¶
type ObjectNameProvider ¶
type ObjectNameProvider interface {
ObjectName() string
}
TODO [SNOW-1501905]: describe
type ResourceSchemaDetails ¶
type ResourceSchemaDetails struct { Name string Attributes []SchemaAttribute }
func ExtractResourceSchemaDetails ¶
func ExtractResourceSchemaDetails(name string, schema map[string]*schema.Schema) ResourceSchemaDetails
TODO: test
func (ResourceSchemaDetails) ObjectName ¶
func (s ResourceSchemaDetails) ObjectName() string
type SchemaAttribute ¶
type SdkObjectDetails ¶
type SdkObjectDetails struct { IdType string ObjectType sdk.ObjectType StructDetails }
type StructDetails ¶
func ExtractStructDetails ¶
func ExtractStructDetails(s any) StructDetails
func (StructDetails) ObjectName ¶
func (s StructDetails) ObjectName() string
Click to show internal directories.
Click to hide internal directories.