models

package
v1.0.0-alpha5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToDbColumn

func ToDbColumn(definition ColumnDefinition) (*gocql.ColumnMetadata, error)

ToDbColumn gets a gocql column for the provided definition

Types

type Changeset

type Changeset struct {
	// The name of the column to be updated.
	Column string `json:"column" validate:"required"`

	// The value for the column that will be updated for all matching rows.
	Value interface{} `json:"value" validate:"required"`
}

Changeset is a column and associated value to be used when updating a row.

type ClusteringExpression

type ClusteringExpression struct {
	Column *string `json:"column" validate:"required"`
	Order  *string `json:"order" validate:"required"`
}

ClusteringExpression allows for ordering rows so that storage is able to make use of the on-disk sorting of columns. Specifying order can make query results more efficient.

type Column

type Column struct {
	Name *string `json:"name" validate:"required"`

	// The value to store in the column, can be either a literal or collection
	Value interface{} `json:"value" validate:"required"`
}

Column is a column within a row to be added to a table

type ColumnDefinition

type ColumnDefinition struct {
	// Name is a unique name for the column.
	Name string `json:"name" validate:"required"`

	// TypeDefinition defines the type of data allowed in the column
	TypeDefinition string `` /* 191-byte string literal not displayed */

	// Denotes that the column is shared by all rows of a partition
	Static bool `json:"static,omitempty"`
}

ColumnDefinition defines a column to be added to a table

type ColumnUpdate

type ColumnUpdate struct {

	// NewName is the new name of the column.
	NewName string `json:"newName" validate:"required"`
}

ColumnUpdate changes the name of a primary key column and preserves the existing values.

type ColumnsResponse

type ColumnsResponse struct {
	Success bool `json:"success,omitempty"`
}

type Filter

type Filter struct {
	ColumnName string        `json:"columnName" validate:"required"`
	Operator   string        `json:"operator" validate:"required,oneof=eq notEq gt gte lt lte in"`
	Value      []interface{} `json:"value" validate:"required"`
}

type ModelError

type ModelError struct {

	// A human readable description of the error state
	Description string `json:"description,omitempty"`

	// The internal number referencing the error state
	InternalCode string `json:"internalCode,omitempty"`
}

A description of an error state

type PrimaryKey

type PrimaryKey struct {

	// The column(s) that will constitute the partition key.
	PartitionKey []string `json:"partitionKey" validate:"required"`

	// The column(s) that will constitute the clustering key.
	ClusteringKey []string `json:"clusteringKey,omitempty"`
}

PrimaryKey defines a column list for the primary key. Can be either a single column, compound primary key, or composite partition key. Provide multiple columns for the partition key to define a composite partition key.

type Query

type Query struct {
	ColumnNames []string              `json:"columnNames,omitempty"`
	Filters     []Filter              `json:"filters" validate:"required"`
	OrderBy     *ClusteringExpression `json:"orderBy,omitempty"`
	PageSize    int                   `json:"pageSize,omitempty"`
	PageState   string                `json:"pageState,omitempty"`
}

type RowAdd

type RowAdd struct {
	Columns []Column `json:"columns" validate:"required"`
}

RowAdd defines a row to be added to a table

type Rows

type Rows struct {
	Rows      []map[string]interface{} `json:"rows,omitempty"`
	PageState string                   `json:"pageState,omitempty"`
	Count     int                      `json:"_count,omitempty"`
}

type RowsResponse

type RowsResponse struct {
	Success bool `json:"success,omitempty"`

	RowsModified int32 `json:"rowsModified,omitempty"`
}

type RowsUpdate

type RowsUpdate struct {
	Changeset []Changeset `json:"changeset" validate:"required"`
}

RowsUpdate defines an update operation on rows within a table.

type Table

type Table struct {
	Name              string             `json:"name,omitempty"`
	Keyspace          string             `json:"keyspace,omitempty"`
	ColumnDefinitions []ColumnDefinition `json:"columnDefinitions,omitempty"`
	PrimaryKey        *PrimaryKey        `json:"primaryKey,omitempty"`
	TableOptions      *TableOptions      `json:"tableOptions,omitempty"`
}

type TableAdd

type TableAdd struct {
	Name string `validate:"required"`

	// Attempting to create an existing table returns an error unless the IF NOT EXISTS option is used. If the option is
	// used, the statement if a no-op is the table already exists.
	IfNotExists bool `json:"ifNotExists,omitempty"`

	ColumnDefinitions []ColumnDefinition `json:"columnDefinitions,omitempty"`

	// Defines a column list for the primary key. Can be either a single column, compound primary key, or composite partition key.
	PrimaryKey *PrimaryKey `json:"primaryKey" validate:"required"`

	TableOptions *TableOptions `json:"tableOptions,omitempty"`
}

TableAdd defines the table to be added to an existing keyspace

type TableOptions

type TableOptions struct {

	// TTL (Time To Live) in seconds, where zero is disabled. The maximum configurable value is 630720000 (20 years). If
	// the value is greater than zero, TTL is enabled for the entire table and an expiration timestamp is added to each
	// column. A new TTL timestamp is calculated each time the data is updated and the row is removed after all the data expires.
	DefaultTimeToLive *int32 `json:"defaultTimeToLive,omitempty" validate:"gte=0,lte=630720000"`

	ClusteringExpression []ClusteringExpression `json:"clusteringExpression,omitempty"`
}

TableOptions are various properties that tune data handling, including I/O operations, compression, and compaction.

type TablesResponse

type TablesResponse struct {
	Success bool `json:"success,omitempty"`
}

Jump to

Keyboard shortcuts

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