-
Notifications
You must be signed in to change notification settings - Fork 14
/
column.go
37 lines (33 loc) · 1.17 KB
/
column.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package plugin
import (
"github.com/turbot/steampipe-plugin-sdk/v4/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/v4/plugin/transform"
)
// Column is a struct representing a column defintion
// it is not mutated and contains column data, in a format compatible with proto ColumnDefinition
type Column struct {
// column name
Name string
// column type
Type proto.ColumnType
// column description
Description string
// explicitly specify the function which populates this data
// - this is only needed if any of the default hydrate functions wil NOT return this column
Hydrate HydrateFunc
// the default column value
Default interface{}
// a list of transforms to generate the column value
Transform *transform.ColumnTransforms
}
// QueryColumn is struct storing column name and resolved hydrate name
// this is used in the query data when the hydrate funciton has been resolved
type QueryColumn struct {
*Column
// the name of the hydrate function which will be used to populate this column
// - this may be a default hydrate function
hydrateName string
}
func NewQueryColumn(column *Column, hydrateName string) *QueryColumn {
return &QueryColumn{column, hydrateName}
}