Documentation ¶
Index ¶
- Constants
- func ColumnNames(columns []*queryresult.ColumnDef) []string
- func ColumnValueAsString(val interface{}, col *queryresult.ColumnDef, opts ...ColumnValueOption) (result string, err error)
- func ColumnValuesAsString(values []interface{}, columns []*queryresult.ColumnDef, ...) ([]string, error)
- func GetAsTableRow(item interface{}) (printers.TableRow, []printers.TableColumnDefinition)
- func GetMaxCols() int
- func GetPrinter[T any](cmd *cobra.Command) (printers.ResourcePrinter[T], error)
- func ListResources[T modconfig.HclResource](cmd *cobra.Command)
- func NewDisplayConfiguration() *displayConfiguration
- func ParseJSONOutputColumnValue(val interface{}, col *queryresult.ColumnDef) (interface{}, error)
- func ShowOutput(ctx context.Context, result *queryresult.Result, opts ...DisplayOption) int
- func ShowPaged(ctx context.Context, content string)
- func ShowResource[T modconfig.HclResource](cmd *cobra.Command, args []string)
- func ShowVarsListJson(vars []*modconfig.Variable)
- func ShowVarsListTable(vars []*modconfig.Variable)
- func ShowWrappedTable(headers []string, rows [][]string, opts *ShowWrappedTableOptions)
- type ColumnTag
- type ColumnValueOption
- type DisplayOption
- type PrintableHclResource
- type ShowWrappedTableOptions
Constants ¶
const TagColumn = "column"
TagColumn is the tag used to specify the column name and type in the introspection tables
Variables ¶
This section is empty.
Functions ¶
func ColumnNames ¶
func ColumnNames(columns []*queryresult.ColumnDef) []string
ColumnNames :: extract names from columns
func ColumnValueAsString ¶
func ColumnValueAsString(val interface{}, col *queryresult.ColumnDef, opts ...ColumnValueOption) (result string, err error)
ColumnValueAsString converts column value to string
func ColumnValuesAsString ¶
func ColumnValuesAsString(values []interface{}, columns []*queryresult.ColumnDef, opts ...ColumnValueOption) ([]string, error)
ColumnValuesAsString converts a slice of columns into strings
func GetAsTableRow ¶
func GetAsTableRow(item interface{}) (printers.TableRow, []printers.TableColumnDefinition)
GetAsTableRow returns the item as a table row
func GetMaxCols ¶
func GetMaxCols() int
func GetPrinter ¶
TODO is this even needed
func ListResources ¶
func ListResources[T modconfig.HclResource](cmd *cobra.Command)
func NewDisplayConfiguration ¶
func NewDisplayConfiguration() *displayConfiguration
NewDisplayConfiguration creates a default configuration with timing set to true if both --timing is true and --output is table
func ParseJSONOutputColumnValue ¶
func ParseJSONOutputColumnValue(val interface{}, col *queryresult.ColumnDef) (interface{}, error)
ParseJSONOutputColumnValue segregate data types, ignore string conversion for certain data types : JSON, JSONB, BOOL and so on..
func ShowOutput ¶
func ShowOutput(ctx context.Context, result *queryresult.Result, opts ...DisplayOption) int
ShowOutput displays the output using the proper formatter as applicable
func ShowResource ¶
func ShowResource[T modconfig.HclResource](cmd *cobra.Command, args []string)
func ShowVarsListJson ¶
func ShowVarsListTable ¶
func ShowWrappedTable ¶
func ShowWrappedTable(headers []string, rows [][]string, opts *ShowWrappedTableOptions)
Types ¶
type ColumnValueOption ¶
type ColumnValueOption func(opt *columnValueSettings)
func WithNullString ¶
func WithNullString(nullString string) ColumnValueOption
type DisplayOption ¶
type DisplayOption = func(config *displayConfiguration)
func WithTimingDisabled ¶
func WithTimingDisabled() DisplayOption
WithTimingDisabled forcefully disables display of timing data
type PrintableHclResource ¶
func NewPrintableHclResource ¶
func NewPrintableHclResource[T printers.Listable](items []T) *PrintableHclResource[T]
func (PrintableHclResource[T]) GetItems ¶
func (p PrintableHclResource[T]) GetItems() []T