Documentation ¶
Overview ¶
Package codgen helps autogenerate tables for CloudQuery source plugins from Go structs (of relevant SDKs)
Index ¶
- Variables
- type ColumnDefinition
- type ColumnDefinitions
- type ResourceDefinition
- type TableDefinition
- type TableOptions
- func WithExtraColumns(columns []ColumnDefinition) TableOptions
- func WithNameTransformer(transformer func(field reflect.StructField) string) TableOptions
- func WithSkipFields(fields []string) TableOptions
- func WithUnwrapAllEmbeddedStructs() TableOptions
- func WithUnwrapFieldsStructs(fields []string) TableOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var TemplatesFS embed.FS
Functions ¶
This section is empty.
Types ¶
type ColumnDefinition ¶
type ColumnDefinitions ¶
type ColumnDefinitions []ColumnDefinition
func (ColumnDefinitions) GetByName ¶
func (c ColumnDefinitions) GetByName(name string) *ColumnDefinition
type ResourceDefinition ¶
type ResourceDefinition struct { Name string Table *TableDefinition }
type TableDefinition ¶
type TableDefinition struct { Name string Columns ColumnDefinitions Description string Relations []string Resolver string IgnoreError string Multiplex string PostResourceResolver string PreResourceResolver string // contains filtered or unexported fields }
func NewTableFromStruct ¶
func NewTableFromStruct(name string, obj interface{}, opts ...TableOptions) (*TableDefinition, error)
NewTableFromStruct creates a new TableDefinition from a struct by inspecting its fields
func (*TableDefinition) GenerateTemplate ¶
func (t *TableDefinition) GenerateTemplate(wr io.Writer) error
type TableOptions ¶
type TableOptions func(*TableDefinition)
func WithExtraColumns ¶
func WithExtraColumns(columns []ColumnDefinition) TableOptions
func WithNameTransformer ¶
func WithNameTransformer(transformer func(field reflect.StructField) string) TableOptions
func WithSkipFields ¶
func WithSkipFields(fields []string) TableOptions
func WithUnwrapAllEmbeddedStructs ¶ added in v0.6.1
func WithUnwrapAllEmbeddedStructs() TableOptions
Unwrap all fields that are embedded structs (1 level deep only)
func WithUnwrapFieldsStructs ¶ added in v0.6.1
func WithUnwrapFieldsStructs(fields []string) TableOptions
Unwrap specific struct fields (1 level deep only)
Click to show internal directories.
Click to hide internal directories.