table

package
v1.3.2-6sack Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) 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) 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.

Jump to

Keyboard shortcuts

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