Documentation ¶
Index ¶
- Constants
- Variables
- func ChalkMarshal(attrs map[string]any) ([]byte, error)
- func ChalkUnmarshal(body []byte) (map[string]any, error)
- func ChalkpySnakeCase(s string) string
- func ColumnMapToRecord(inputs map[string]any) (arrow.Record, error)
- func ConvertBytesToTable(byteArr []byte) (result arrow.Table, err error)
- func CreateOnlineQueryBulkBody(inputs map[string]any, header FeatherRequestHeader) ([]byte, error)
- func CreateUploadFeaturesBody(inputs map[string]any) ([]byte, error)
- func ExpandTilde(path string) (string, error)
- func ExtractFeaturesFromTable(table arrow.Table) ([]map[string]any, error)
- func FileExists(path string) bool
- func FormatBucketDuration(duration int) string
- func GenerateGetEnumFunction[K comparable](valueToEnum map[string]K, enumName string) func(string) (*K, error)
- func GetBucketFromFqn(fqn string) (string, error)
- func GetHeaderFromSerializedOnlineQueryBulkBody(body []byte) (map[string]any, error)
- func GetReflectValue(value any, typ reflect.Type, nsMemo NamespaceMemo) (*reflect.Value, error)
- func GetValueFromArrowArray(a arrow.Array, idx int) (any, error)
- func GetWindowBucketsFromStructTag(field reflect.StructField) ([]string, error)
- func GetWindowBucketsSecondsFromStructTag(field reflect.StructField) ([]int, error)
- func HasDontOmitTag(field reflect.StructField) bool
- func InputsToArrowBytes(inputs map[string]any) ([]byte, error)
- func Int64ToInt(value int64) (int, error)
- func IsDataclass(field reflect.Value) bool
- func IsFeaturesClass(typ reflect.Type) bool
- func IsStruct(typ reflect.Type) bool
- func IsTypeDataclass(typ reflect.Type) bool
- func KindMismatchError(expected reflect.Kind, actual reflect.Kind) error
- func ParseBucketDuration(durationStr string) (int, error)
- func ReflectPtr(value reflect.Value) reflect.Value
- func ResolveFeatureName(field reflect.StructField) (string, error)
- func SetMapEntryValue(mapValue reflect.Value, key string, value any, nsMemo NamespaceMemo) error
- func StringOrNil(value string) *string
- type BufferWriteSeeker
- type ChunkResult
- type FeatherRequestHeader
- type FeatureEncodingOptions
- type NamespaceMemo
- type NamespaceMemoItem
- type Numbers
- type OfflineQueryInputSerialized
- type OfflineQueryRequestSerialized
- type OnlineQueryContext
- type OnlineQueryRequestSerialized
Constants ¶
const ApiServerEnvVarKey = "CHALK_API_SERVER"
const ClientIdEnvVarKey = "CHALK_CLIENT_ID"
const ClientSecretEnvVarKey = "CHALK_CLIENT_SECRET"
const EnvironmentEnvVarKey = "CHALK_ACTIVE_ENVIRONMENT"
Variables ¶
var ChalkTag = "chalk"
var NameTag = "name"
var NowTimeFormat = "2006-01-02T15:04:05.000000-07:00"
var SkipUnmarshalFqnRoots = map[string]bool{ "__chalk__": true, }
var WindowsTag = "windows"
Functions ¶
func ChalkMarshal ¶ added in v0.3.13
ChalkMarshal converts a map to a byte array. Follows the byte-packing format as described in the Chalk Python repo's `byte_transmit.serialize()` function.
func ChalkpySnakeCase ¶ added in v0.8.2
ChalkpySnakeCase aims to be in parity with our Python implementation of snake_case
func ColumnMapToRecord ¶ added in v0.7.0
ColumnMapToRecord converts a map of column names to slices of values to an Arrow Record.
func ConvertBytesToTable ¶ added in v0.3.7
func CreateOnlineQueryBulkBody ¶ added in v0.3.6
func CreateOnlineQueryBulkBody(inputs map[string]any, header FeatherRequestHeader) ([]byte, error)
func CreateUploadFeaturesBody ¶ added in v0.3.13
func ExpandTilde ¶ added in v0.3.3
func ExtractFeaturesFromTable ¶ added in v0.7.0
func FileExists ¶
func FormatBucketDuration ¶
FormatBucketDuration takes an integer number of seconds and returns a string representation that satisfies these conditions:
- the largest possible unit of time (e.g. "10m" instead of "600s")
- a single unit of time (e.g. "601s" instead of "10m1s")
func GenerateGetEnumFunction ¶
func GenerateGetEnumFunction[K comparable](valueToEnum map[string]K, enumName string) func(string) (*K, error)
func GetBucketFromFqn ¶ added in v0.16.0
func GetHeaderFromSerializedOnlineQueryBulkBody ¶ added in v0.5.1
func GetReflectValue ¶ added in v0.3.6
GetReflectValue returns a reflect.Value of the given type from the given non-reflect value.
func GetValueFromArrowArray ¶ added in v0.7.0
func GetWindowBucketsFromStructTag ¶ added in v0.16.0
func GetWindowBucketsFromStructTag(field reflect.StructField) ([]string, error)
func GetWindowBucketsSecondsFromStructTag ¶ added in v0.16.0
func GetWindowBucketsSecondsFromStructTag(field reflect.StructField) ([]int, error)
func HasDontOmitTag ¶ added in v0.16.0
func HasDontOmitTag(field reflect.StructField) bool
func InputsToArrowBytes ¶ added in v0.13.0
InputsToArrowBytes converts map of FQNs to slice of values to an Arrow Record, serialized.
func Int64ToInt ¶ added in v0.18.27
func IsDataclass ¶ added in v0.3.6
func IsFeaturesClass ¶ added in v0.18.29
func IsTypeDataclass ¶ added in v0.11.0
func KindMismatchError ¶ added in v0.8.4
func ParseBucketDuration ¶
ParseBucketDuration parses a bucket duration string and returns the duration in seconds. The input string must be of the form "Nunit" where N is a positive integer and unit is one of "s", "m", "h", "d", or "w".
func ResolveFeatureName ¶ added in v0.11.0
func ResolveFeatureName(field reflect.StructField) (string, error)
func SetMapEntryValue ¶ added in v0.16.0
SetMapEntryValue exists as a separate special setter function because while all other fields are settable and can be passed into GetReflectValue to be set, map field values are not settable, and the entire map has to be passed instead.
func StringOrNil ¶
Types ¶
type BufferWriteSeeker ¶ added in v0.3.7
type BufferWriteSeeker struct {
// contains filtered or unexported fields
}
func (*BufferWriteSeeker) Bytes ¶ added in v0.3.7
func (b *BufferWriteSeeker) Bytes() []byte
type ChunkResult ¶ added in v0.18.27
type ChunkResult struct {
// contains filtered or unexported fields
}
type FeatherRequestHeader ¶ added in v0.4.7
type FeatherRequestHeader struct { Outputs []string `json:"outputs"` BranchId *string `json:"branch_id"` Explain bool `json:"explain"` Context *OnlineQueryContext `json:"context"` Staleness map[string]string `json:"staleness"` Now []string `json:"now,omitempty"` IncludeMeta bool `json:"include_meta"` CorrelationId *string `json:"correlation_id"` QueryName *string `json:"query_name"` QueryNameVersion *string `json:"query_name_version"` Meta map[string]string `json:"meta"` StorePlanStages bool `json:"store_plan_stages"` }
type FeatureEncodingOptions ¶ added in v0.17.0
type FeatureEncodingOptions struct {
EncodeStructsAsObjects bool `json:"encode_structs_as_objects"`
}
type NamespaceMemo ¶ added in v0.18.26
type NamespaceMemo map[string]*NamespaceMemoItem
type NamespaceMemoItem ¶ added in v0.18.26
type NamespaceMemoItem struct { // Root and non-root FQN as keys ResolvedFieldNameToIndices map[string][]int // Non-root FQN as keys only StructFieldsSet map[string]bool }
func NewNamespaceMemoItem ¶ added in v0.18.26
func NewNamespaceMemoItem() *NamespaceMemoItem
type OfflineQueryInputSerialized ¶ added in v0.14.2
type OfflineQueryRequestSerialized ¶ added in v0.14.2
type OfflineQueryRequestSerialized struct { Input OfflineQueryInputSerialized `json:"input"` Output []string `json:"output"` RequiredOutput []string `json:"required_output"` DatasetName *string `json:"dataset_name"` Branch *string `json:"branch"` MaxSamples *int `json:"max_samples"` DestinationFormat string `json:"destination_format"` JobId *string `json:"job_id"` MaxCacheAge *int `json:"max_cache_age_secs"` ObservedAtLowerBound *time.Time `json:"observed_at_lower_bound"` ObservedAtUpperBound *time.Time `json:"observed_at_upper_bound"` Tags []string `json:"tags"` }
type OnlineQueryContext ¶ added in v0.14.2
type OnlineQueryRequestSerialized ¶ added in v0.14.2
type OnlineQueryRequestSerialized struct { Inputs map[string]any `json:"inputs"` Outputs []string `json:"outputs"` Context OnlineQueryContext `json:"context"` Staleness map[string]string `json:"staleness"` IncludeMeta bool `json:"include_meta"` IncludeMetrics bool `json:"include_metrics"` DeploymentId *string `json:"deployment_id"` QueryName *string `json:"query_name"` CorrelationId *string `json:"correlation_id"` Meta map[string]string `json:"meta"` QueryNameVersion *string `json:"query_name_version"` Now *string `json:"now"` Explain bool `json:"explain"` StorePlanStages bool `json:"store_plan_stages"` EncodingOptions FeatureEncodingOptions `json:"encoding_options"` }