timeplus

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Severity    int            `json:"severity"`
	Action      string         `json:"action"`
	Properties  map[string]any `json:"properties"`
	TriggerSQL  string         `json:"trigger_sql"`
	ResolveSQL  string         `json:"resolve_sql"`
}

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(workspaceID string, apiKey string, replicas *int, opts ClientOptions) (*Client, error)

func (*Client) CreateAlert

func (c *Client) CreateAlert(s *Alert) error

func (*Client) CreateDashboard

func (c *Client) CreateDashboard(d *Dashboard) error

func (*Client) CreateMaterializedView

func (c *Client) CreateMaterializedView(v *MaterializedView) error

func (*Client) CreateSink

func (c *Client) CreateSink(s *Sink) error

func (*Client) CreateSource

func (c *Client) CreateSource(s *Source) error

func (*Client) CreateStream

func (c *Client) CreateStream(s *Stream) error

func (*Client) CreateUDF

func (c *Client) CreateUDF(u *UDF) error

func (*Client) CreateView

func (c *Client) CreateView(v *View) error

func (*Client) DeleteAlert

func (c *Client) DeleteAlert(s *Alert) error

func (*Client) DeleteDashboard

func (c *Client) DeleteDashboard(id string) error

func (*Client) DeleteMaterializedView

func (c *Client) DeleteMaterializedView(v *MaterializedView) error

func (*Client) DeleteSink

func (c *Client) DeleteSink(s *Sink) error

func (*Client) DeleteSource

func (c *Client) DeleteSource(s *Source) error

func (*Client) DeleteStream

func (c *Client) DeleteStream(s *Stream) error

func (*Client) DeleteUDF

func (c *Client) DeleteUDF(name string) error

func (*Client) DeleteView

func (c *Client) DeleteView(v *View) error

func (*Client) GetAlert

func (c *Client) GetAlert(id string) (Alert, error)

func (*Client) GetDashboard

func (c *Client) GetDashboard(id string) (Dashboard, error)

func (*Client) GetMaterializedView

func (c *Client) GetMaterializedView(name string) (v MaterializedView, err error)

func (*Client) GetSink

func (c *Client) GetSink(id string) (Sink, error)

func (*Client) GetSource

func (c *Client) GetSource(id string) (Source, error)

func (*Client) GetStream

func (c *Client) GetStream(name string) (Stream, error)

func (*Client) GetUDF

func (c *Client) GetUDF(name string) (UDF, error)

func (*Client) GetView

func (c *Client) GetView(name string) (v View, err error)

func (*Client) UpdateAlert

func (c *Client) UpdateAlert(s *Alert) error

func (*Client) UpdateDashboard

func (c *Client) UpdateDashboard(s *Dashboard) error

func (*Client) UpdateMaterializedView

func (c *Client) UpdateMaterializedView(v *MaterializedView) error

func (*Client) UpdateSink

func (c *Client) UpdateSink(s *Sink) error

func (*Client) UpdateSource

func (c *Client) UpdateSource(s *Source) error

func (*Client) UpdateStream

func (c *Client) UpdateStream(s *Stream) error

func (*Client) UpdateUDF

func (c *Client) UpdateUDF(u *UDF) error

func (*Client) UpdateView

func (c *Client) UpdateView(v *View) error

type ClientOptions

type ClientOptions struct {
	BaseURL string
}

optional configurations for the client

func DefaultOptions

func DefaultOptions() ClientOptions

type Column

type Column struct {
	Name                    string `json:"name" binding:"required" example:"name"`
	Type                    string `json:"type" binding:"required" example:"string"`
	Default                 string `json:"default,omitempty"`
	Codec                   string `json:"codec"`
	TTLExpression           string `json:"ttl_expression,omitempty"`
	SkippingIndexExpression string `json:"skipping_index_expression,omitempty"`
}

type Dashboard

type Dashboard struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Panels      []Panel `json:"panels"`
}

type MaterializedView

type MaterializedView struct {
	View

	TargetStream   string
	RetentionBytes int
	RetentionMS    int
	TTLExpression  string
}

type Panel

type Panel struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`

	// e.g. {"x":0,"y":0,"w":6,"h":2,"nextX":6,"nextY":2}
	Position map[string]any `json:"position"`

	// e.g. `chart`, `markdown`
	VizType string `json:"viz_type"`

	// For chart, the viz_content is the SQL
	// For markdown, the viz_content is the markdown itself
	VizContent string `json:"viz_content"`

	// The JSON configuration of the viz
	// For chart, it is `{ "chart_type": "line", ...  }`
	// For markdown, it is `{ "favour": "github", ...  }`
	VizConfig map[string]any `json:"viz_config"`
}

type Sink

type Sink struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Query       string `json:"query"`

	// Additional configurations such as broker url and etc. should be passed through `properties`
	Type string `json:"type"`

	// Additional properties that required to write the data to the sink (e.g. broker url). Please refer to the sinks documentation
	Properties map[string]any `json:"properties"`
}

type Source

type Source struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Stream      string         `json:"stream"`
	Type        string         `json:"type"`
	Properties  map[string]any `json:"properties"`
}

type Stream

type Stream struct {
	// Stream name should only contain a maximum of 64 letters, numbers, or _, and start with a letter
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Columns     []Column `json:"columns"`
	// This column will be used as the event time if specified
	EventTimeColumn string `json:"event_time_column,omitempty"`
	// The timezone of the `EventTimeColumn`
	TimestampTimezone       string `json:"event_time_timezone"`
	Shards                  int    `json:"shards,omitempty"`
	ReplicationFactor       int    `json:"replication_factor,omitempty"`
	OrderByExpression       string `json:"order_by_expression,omitempty"`
	OrderByGranularity      string `json:"order_by_granularity,omitempty"`
	PartitionByGranularity  string `json:"partition_by_granularity,omitempty"`
	HistoricalTTLExpression string `json:"ttl_expression,omitempty"` // API request
	TTL                     string `json:"ttl"`                      // API response

	// Default to `append`.
	Mode string `json:"mode,omitempty"`

	// Expression of primary key, required in `changelog_kv` and `versioned_kv` mode
	PrimaryKey string `json:"primary_key,omitempty"`

	// The max size a stream can grow. Any non-positive value means unlimited size. Default to 10 GiB.
	RetentionBytes int `json:"logstore_retention_bytes,omitempty" example:"10737418240"`

	// The max time the data can be retained in the stream. Any non-positive value means unlimited time. Default to 7 days.
	RetentionMS int `json:"logstore_retention_ms,omitempty" example:"604800000"`
}

type StreamMode

type StreamMode string
const (
	StreamModeAppend      StreamMode = "append"
	StreamModeChangeLog   StreamMode = "changelog"
	StreamModeChangeLogKV StreamMode = "changelog_kv"
	StreamModeVersionedKV StreamMode = "versioned_kv"
)

func StreamModeFrom added in v0.1.3

func StreamModeFrom(s string) (StreamMode, error)

type UDF

type UDF struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Type        UDFType `json:"type"`

	// The input argument of the UDF, the type should be Timeplus data types,  not javascript types.
	// Only int8/16/32/64, uint8/16/32/64 are supported.
	Arguments []UDFArgument `json:"arguments"`

	// The erturn type of the UDF
	//   * For UDA: if it returns a single value, the return type is the corresponding data type of Timeplus.
	//     It supports the same types of input arguments, except for datetime, it only supports DateTime64(3).
	ReturnType string `json:"return_type" example:"float64"`

	// Only valid when `type` is `remote`.
	URL string `json:"url,omitempty"`

	// Only valid when `type` is `remote`.
	// This field is used to set the authentication method for remote UDF. It can be either `auth_header` or `none`.
	// When `auth_header` is set, you can configure `auth_context` to specify the HTTP header that be sent the remote URL
	AuthMethod UDFAuthMethod `json:"auth_method,omitempty"`

	// Only valid when `type` is `remote` and `auth_method` is `auth_header`
	AuthContext *UDFAuthContext `json:"auth_context,omitempty"`

	// Only valid when type is 'javascript'. Whether it is an aggregation function.
	IsAggrFunction bool `json:"is_aggregation,omitempty"`

	Source string `json:"source,omitempty"`
}

type UDFArgument

type UDFArgument struct {
	Name string `json:"name" binding:"required" example:"val"`
	Type string `json:"type" binding:"required" example:"float64"`
}

type UDFAuthContext

type UDFAuthContext struct {
	Name  string `json:"key_name"`
	Value string `json:"key_value"`
}

type UDFAuthMethod

type UDFAuthMethod string
const (
	UDFAuthHeader UDFAuthMethod = "auth_header"
	UDFAuthNone   UDFAuthMethod = "none"
)

type UDFType

type UDFType string
const (
	UDFTypeJavascript UDFType = "javascript"
	UDFTypeRemote     UDFType = "remote"
)

type View

type View struct {
	Name        string
	Description string
	Query       string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL