table

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: Apache-2.0 Imports: 1 Imported by: 11

Documentation

Overview

Package table adds support for super simple CRUD operations based on table model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	Name    string
	Columns []string
	PartKey []string
	SortKey []string
}

Metadata represents table schema.

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table allows for simple CRUD operations, it's backed by query builders from gocqlx/qb package.

func New

func New(m Metadata) *Table

New creates new Table based on table schema read from Metadata.

func (*Table) Delete

func (t *Table) Delete(columns ...string) (stmt string, names []string)

Delete returns delete by primary key statement.

func (*Table) DeleteBuilder added in v1.5.0

func (t *Table) DeleteBuilder(columns ...string) *qb.DeleteBuilder

DeleteBuilder returns a builder initialised to delete by primary key statement.

func (*Table) Get

func (t *Table) Get(columns ...string) (stmt string, names []string)

Get returns select by primary key statement.

func (*Table) Insert

func (t *Table) Insert() (stmt string, names []string)

Insert returns insert all columns statement.

func (*Table) Metadata

func (t *Table) Metadata() Metadata

Metadata returns copy of table metadata.

func (*Table) Name

func (t *Table) Name() string

Name returns table name.

func (*Table) PrimaryKeyCmp added in v1.5.0

func (t *Table) PrimaryKeyCmp() []qb.Cmp

PrimaryKeyCmp returns copy of table's primaryKeyCmp.

func (*Table) Select

func (t *Table) Select(columns ...string) (stmt string, names []string)

Select returns select by partition key statement.

func (*Table) SelectBuilder

func (t *Table) SelectBuilder(columns ...string) *qb.SelectBuilder

SelectBuilder returns a builder initialised to select by partition key statement.

func (*Table) Update

func (t *Table) Update(columns ...string) (stmt string, names []string)

Update returns update by primary key statement.

func (*Table) UpdateBuilder added in v1.5.0

func (t *Table) UpdateBuilder(columns ...string) *qb.UpdateBuilder

UpdateBuilder returns a builder initialised to update by primary key statement.

Jump to

Keyboard shortcuts

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