schema

package
v0.0.0-...-2f06d21 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package schema extracts schema structure from CQL files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Comment string
	Name    string
	CqlType string
}

type ParseError

type ParseError struct {
	Message string
}

func (*ParseError) Error

func (pe *ParseError) Error() string

type Schema

type Schema struct {
	Tables []*Table
}

func Parse

func Parse(r io.Reader) (*Schema, error)

func ParseString

func ParseString(cql string) (*Schema, error)

func (*Schema) GetTable

func (s *Schema) GetTable(keyspace, name string) *Table

GetTable finds a table with the keyspace and name. Returns nil if not found.

type Table

type Table struct {
	Comment  string
	Keyspace string
	Name     string
	Columns  []*Column
}

func (*Table) DropColumn

func (s *Table) DropColumn(name string)

DropColumn drops a column. Does nothing if not found.

func (*Table) GetColumn

func (s *Table) GetColumn(name string) *Column

GetColumn finds a column by name. Returns nil if not found.

func (*Table) RenameColumn

func (s *Table) RenameColumn(oldName, newName string)

RenameColumn renames a column.

Jump to

Keyboard shortcuts

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