Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeLDBTableName(tableName string) (fn FamilyName, tn TableName, err error)
- func FieldTypeMap() map[string]FieldType
- func LDBTableName(famName FamilyName, tblName TableName) string
- func StringifyFieldNames(fns []FieldName) []string
- type DBColumnInfo
- type DBColumnMeta
- type DMLSequence
- type DMLStatement
- type FamilyName
- type FamilyTable
- type FieldName
- type FieldType
- type NamedFieldType
- type PrimaryKey
- type Table
- type TableName
- type WriterName
Constants ¶
const ( MinFamilyNameLength = 3 MaxFamilyNameLength = 30 )
const ( MinFieldNameLength = 1 MaxFieldNameLength = 64 )
const ( MinTableNameLength = 3 MaxTableNameLength = 50 )
const ( MinWriterNameLength = 3 MaxWriterNameLength = 50 )
const DMLTxBeginKey = "--- BEGIN"
These are the markers used to indicate the start and end of transactions in ctldb's DML log.
const DMLTxEndKey = "--- COMMIT"
Variables ¶
var ( ErrFamilyNameInvalid = errors.New("Family names must be only letters, numbers, and single underscore") ErrFamilyNameTooLong = fmt.Errorf("Family names can only be up to %d characters", MaxFamilyNameLength) ErrFamilyNameTooShort = fmt.Errorf("Family names must be at least %d characters", MinFamilyNameLength) )
var ( ErrFieldNameInvalid = errors.New("Field names must be only letters, numbers, and underscore") ErrFieldNameTooLong = fmt.Errorf("Field names can only be up to %d characters", MaxFieldNameLength) ErrFieldNameTooShort = fmt.Errorf("Field names must be at least %d characters", MinFieldNameLength) )
var ( ErrTableNameInvalid = errors.New("Table names must be only letters, numbers, and single underscore") ErrTableNameTooLong = fmt.Errorf("Table names can only be up to %d characters", MaxTableNameLength) ErrTableNameTooShort = fmt.Errorf("Table names must be at least %d characters", MinTableNameLength) )
var ( ErrWriterNameTooLong = fmt.Errorf("Writer names can only be up to %d characters", MaxWriterNameLength) ErrWriterNameTooShort = fmt.Errorf("Writer names must be at least %d characters", MinWriterNameLength) )
var FieldTypeStringsByFieldType = map[FieldType]string{ FTString: "string", FTInteger: "integer", FTDecimal: "decimal", FTText: "text", FTBinary: "binary", FTByteString: "bytestring", }
Maps FieldTypes to their stringly typed version
var PrimaryKeyZero = PrimaryKey{}
var TableNameZero = TableName{}
Functions ¶
func DecodeLDBTableName ¶
func DecodeLDBTableName(tableName string) (fn FamilyName, tn TableName, err error)
The opposite of ldbTableName()
func FieldTypeMap ¶
Returns a map of stringly typed field types to strongly typed field types
func LDBTableName ¶
func LDBTableName(famName FamilyName, tblName TableName) string
Converts a family/table name pair to a concatenated version that works with SQLite, which doesn't support SQL schema objects. Use ___ to avoid easy accidental hijacks.
func StringifyFieldNames ¶
Types ¶
type DBColumnInfo ¶
type DBColumnMeta ¶
func DBColumnMetaFromRows ¶
func DBColumnMetaFromRows(rows *sql.Rows) ([]DBColumnMeta, error)
type DMLSequence ¶
type DMLSequence int64
func (DMLSequence) Int ¶
func (seq DMLSequence) Int() int64
type DMLStatement ¶
type DMLStatement struct { Sequence DMLSequence Timestamp time.Time Statement string }
type FamilyName ¶
type FamilyName struct {
Name string
}
func NewFamilyName ¶
func NewFamilyName(name string) (FamilyName, error)
func (FamilyName) String ¶
func (fn FamilyName) String() string
type FamilyTable ¶
FamilyTable composes a family name and a table name
func ParseFamilyTable ¶
func ParseFamilyTable(fullName string) (ft FamilyTable, ok bool)
parseFamilyTable breaks up a full table name into family/table parts.
func (FamilyTable) String ¶
func (ft FamilyTable) String() string
String is a Stringer implementation that produces the fully qualified table name
func (FamilyTable) Tag ¶
func (ft FamilyTable) Tag() stats.Tag
Tag produces a stats tag that can be used to represent this table
type FieldType ¶
type FieldType int
const ( FTString FieldType FTInteger FTDecimal FTText FTBinary FTByteString )
func SqlTypeToFieldType ¶
Convert a known SQL type string to a FieldType
func UnzipFieldsParam ¶
type NamedFieldType ¶
Roses are red, Violets are blue, This type would fill me with less existential dread, If Go had a tuple type instead
type PrimaryKey ¶
func NewPKFromRawNamesAndFieldTypes ¶
func NewPKFromRawNamesAndFieldTypes(names []string, types []FieldType) (PrimaryKey, error)
builds a new primary key from a slice of field names and the corresponding field types.
func NewPKFromRawNamesAndTypes ¶
func NewPKFromRawNamesAndTypes(names []string, types []string) (PrimaryKey, error)
builds a new primary key from a slice of field name and the string representation of the field types. The field types in this case should have entries in the _sqlTypesToFieldTypes map. A failure to map from a field type string to a FieldType will result in an error.
func (*PrimaryKey) Strings ¶
func (pk *PrimaryKey) Strings() []string
Returns the list of fields as strings
type TableName ¶
type TableName struct {
Name string
}
use newTableName to construct a tableName
func NewTableName ¶
type WriterName ¶
type WriterName struct {
Name string
}
use newWriterName to construct a writerName
func NewWriterName ¶
func NewWriterName(name string) (WriterName, error)
func (WriterName) String ¶
func (wn WriterName) String() string