Documentation ¶
Index ¶
- func ExecuteTemplate[T any](name string, fileTemplate string, om T) string
- func GetFile(file ...string) string
- func GetImports(filePath string) ([]string, error)
- func NewCSGenBuilderForFile(name string, pkg string) *strings.Builder
- func WriteGeneratedGoFile(name string, contents string) error
- type Function
- type Interface
- type Struct
- type StructField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteTemplate ¶
ExecuteTemplate executes a template against a given object and return the output as a string
func GetImports ¶
GetImports returns all of the imports in a given file
func NewCSGenBuilderForFile ¶
NewCSGenBuilderForFile returns a string buider with a common header for generated files
func WriteGeneratedGoFile ¶
WriteGeneratedGoFile create a text file with the passed in name and contents
Types ¶
type Function ¶
type Function struct { Name string Receiver *string Arguments []StructField Returns []StructField IsPublic bool }
func GetFunctions ¶
GetFunctions returns all of the functions in a given file
type Interface ¶
func GetInterfaces ¶
GetInterfaces get a list of all declared interfaces in a given file
type Struct ¶
type Struct struct { Name string FilePath string Package string Type string Fields []StructField }
Struct a struct that abstracts a golang struct
func GetStructs ¶
GetStructs return a list of all structs in a given file
func (*Struct) GetField ¶
func (s *Struct) GetField(name string) *StructField
GetField return a field object of a struct by its name
type StructField ¶
type StructField struct { Name string Type string TagString string IsPrimitive bool IsPointer bool IsSlice bool IsPublic bool }
StructField a struct that represents a single field within a struct abstraction
func GetVariables ¶
func GetVariables(filePath string) ([]StructField, error)
GetVariables returns a list of all variable definitions in a given file
func (*StructField) GetTag ¶
func (s *StructField) GetTag(name string) string
GetTag returns a single tag value by name based on the standard format rules