Documentation ¶
Overview ¶
Package sqlbase is a generated protocol buffer package.
It is generated from these files:
cockroach/sql/sqlbase/encoded_datum.proto cockroach/sql/sqlbase/privilege.proto cockroach/sql/sqlbase/structured.proto
It has these top-level messages:
UserPrivileges PrivilegeDescriptor ColumnType TableAndIndexID ColumnDescriptor ColumnFamilyDescriptor IndexDescriptor DescriptorMutation TableDescriptor DatabaseDescriptor Descriptor
Index ¶
- Constants
- Variables
- func CheckColumnType(col ColumnDescriptor, val parser.Datum, pmap *parser.PlaceholderInfo) error
- func CheckValueWidth(col ColumnDescriptor, val parser.Datum) error
- func ColumnsSelectors(cols []ColumnDescriptor) parser.SelectExprs
- func DecodeIndexKey(a *DatumAlloc, desc *TableDescriptor, indexID IndexID, ...) ([]byte, error)
- func DecodeKeyVals(a *DatumAlloc, valTypes, vals []parser.Datum, directions []encoding.Direction, ...) ([]byte, error)
- func DecodeTableKey(a *DatumAlloc, valType parser.Datum, key []byte, dir encoding.Direction) (parser.Datum, []byte, error)
- func DecodeTableValue(a *DatumAlloc, valType parser.Datum, b []byte) (parser.Datum, []byte, error)
- func EncodeColumns(columnIDs []ColumnID, directions directions, colMap map[ColumnID]int, ...) (key []byte, containsNull bool, err error)
- func EncodeDTuple(b []byte, d parser.DTuple) ([]byte, error)
- func EncodeDatum(b []byte, d parser.Datum) ([]byte, error)
- func EncodeIndexKey(index *IndexDescriptor, colMap map[ColumnID]int, values []parser.Datum, ...) (key []byte, containsNull bool, err error)
- func EncodeSecondaryIndexes(tableID ID, indexes []IndexDescriptor, colMap map[ColumnID]int, ...) error
- func EncodeTableKey(b []byte, val parser.Datum, dir encoding.Direction) ([]byte, error)
- func EncodeTableValue(appendTo []byte, colID ColumnID, val parser.Datum) ([]byte, error)
- func EqualName(a, b string) bool
- func ExtractIndexKey(a *DatumAlloc, tableDesc *TableDescriptor, entry client.KeyValue) (roachpb.Key, error)
- func IsIntegrityConstraintError(err error) bool
- func IsSystemConfigID(id ID) bool
- func MakeColumnDefDescs(d *parser.ColumnTableDef) (*ColumnDescriptor, *IndexDescriptor, error)
- func MakeDescMetadataKey(descID ID) roachpb.Key
- func MakeIndexKeyPrefix(tableID ID, indexID IndexID) []byte
- func MakeKeyFromEncDatums(values EncDatumRow, directions []IndexDescriptor_Direction, keyPrefix []byte, ...) (key roachpb.Key, err error)
- func MakeKeyVals(desc *TableDescriptor, columnIDs []ColumnID) ([]parser.Datum, error)
- func MakeNameMetadataKey(parentID ID, name string) roachpb.Key
- func MakeZoneKey(id ID) roachpb.Key
- func MarshalColumnValue(col ColumnDescriptor, val parser.Datum) (roachpb.Value, error)
- func NewNonNullViolationError(columnName string) error
- func NewRetryError(cause error) error
- func NewTransactionAbortedError(customMsg string) error
- func NewTransactionCommittedError() error
- func NewUndefinedDatabaseError(name string) error
- func NewUndefinedTableError(name string) error
- func NewUniquenessConstraintViolationError(index *IndexDescriptor, vals []parser.Datum) error
- func NormalizeName(name string) string
- func PrettySpan(span Span, skip int) string
- func PrettySpans(spans []Span, skip int) string
- func RandDatum(rng *rand.Rand, typ ColumnType_Kind, null bool) parser.Datum
- func RunFilter(filter parser.TypedExpr, evalCtx *parser.EvalContext) (bool, error)
- func SanitizeVarFreeExpr(expr parser.Expr, expectedType parser.Datum, context string) error
- func SetKVBatchSize(val int64) func()
- func UnmarshalColumnValue(a *DatumAlloc, kind ColumnType_Kind, value *roachpb.Value) (parser.Datum, error)
- type ColumnDescriptor
- func (*ColumnDescriptor) Descriptor() ([]byte, []int)
- func (m *ColumnDescriptor) Marshal() (data []byte, err error)
- func (m *ColumnDescriptor) MarshalTo(data []byte) (int, error)
- func (*ColumnDescriptor) ProtoMessage()
- func (m *ColumnDescriptor) Reset()
- func (m *ColumnDescriptor) Size() (n int)
- func (m *ColumnDescriptor) String() string
- func (m *ColumnDescriptor) Unmarshal(data []byte) error
- type ColumnFamilyDescriptor
- func (*ColumnFamilyDescriptor) Descriptor() ([]byte, []int)
- func (m *ColumnFamilyDescriptor) Marshal() (data []byte, err error)
- func (m *ColumnFamilyDescriptor) MarshalTo(data []byte) (int, error)
- func (*ColumnFamilyDescriptor) ProtoMessage()
- func (m *ColumnFamilyDescriptor) Reset()
- func (m *ColumnFamilyDescriptor) Size() (n int)
- func (m *ColumnFamilyDescriptor) String() string
- func (m *ColumnFamilyDescriptor) Unmarshal(data []byte) error
- type ColumnID
- type ColumnOrderInfo
- type ColumnOrdering
- type ColumnType
- func (*ColumnType) Descriptor() ([]byte, []int)
- func (m *ColumnType) Marshal() (data []byte, err error)
- func (m *ColumnType) MarshalTo(data []byte) (int, error)
- func (*ColumnType) ProtoMessage()
- func (m *ColumnType) Reset()
- func (c *ColumnType) SQLString() string
- func (m *ColumnType) Size() (n int)
- func (m *ColumnType) String() string
- func (c *ColumnType) ToDatumType() parser.Datum
- func (m *ColumnType) Unmarshal(data []byte) error
- type ColumnType_Kind
- type DatabaseDescriptor
- func (*DatabaseDescriptor) Descriptor() ([]byte, []int)
- func (m *DatabaseDescriptor) GetID() ID
- func (m *DatabaseDescriptor) GetName() string
- func (m *DatabaseDescriptor) GetPrivileges() *PrivilegeDescriptor
- func (m *DatabaseDescriptor) Marshal() (data []byte, err error)
- func (m *DatabaseDescriptor) MarshalTo(data []byte) (int, error)
- func (*DatabaseDescriptor) ProtoMessage()
- func (m *DatabaseDescriptor) Reset()
- func (desc *DatabaseDescriptor) SetID(id ID)
- func (desc *DatabaseDescriptor) SetName(name string)
- func (m *DatabaseDescriptor) Size() (n int)
- func (m *DatabaseDescriptor) String() string
- func (desc *DatabaseDescriptor) TypeName() string
- func (m *DatabaseDescriptor) Unmarshal(data []byte) error
- func (desc *DatabaseDescriptor) Validate() error
- type DatumAlloc
- func (a *DatumAlloc) NewDBytes(v parser.DBytes) *parser.DBytes
- func (a *DatumAlloc) NewDDate(v parser.DDate) *parser.DDate
- func (a *DatumAlloc) NewDDecimal(v parser.DDecimal) *parser.DDecimal
- func (a *DatumAlloc) NewDFloat(v parser.DFloat) *parser.DFloat
- func (a *DatumAlloc) NewDInt(v parser.DInt) *parser.DInt
- func (a *DatumAlloc) NewDInterval(v parser.DInterval) *parser.DInterval
- func (a *DatumAlloc) NewDString(v parser.DString) *parser.DString
- func (a *DatumAlloc) NewDTimestamp(v parser.DTimestamp) *parser.DTimestamp
- func (a *DatumAlloc) NewDTimestampTZ(v parser.DTimestampTZ) *parser.DTimestampTZ
- type DatumEncoding
- type Descriptor
- func (*Descriptor) Descriptor() ([]byte, []int)
- func (m *Descriptor) GetDatabase() *DatabaseDescriptor
- func (desc *Descriptor) GetID() ID
- func (desc *Descriptor) GetName() string
- func (m *Descriptor) GetTable() *TableDescriptor
- func (m *Descriptor) GetUnion() isDescriptor_Union
- func (m *Descriptor) Marshal() (data []byte, err error)
- func (m *Descriptor) MarshalTo(data []byte) (int, error)
- func (*Descriptor) ProtoMessage()
- func (m *Descriptor) Reset()
- func (m *Descriptor) Size() (n int)
- func (m *Descriptor) String() string
- func (m *Descriptor) Unmarshal(data []byte) error
- func (*Descriptor) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type DescriptorKey
- type DescriptorMutation
- func (*DescriptorMutation) Descriptor() ([]byte, []int)
- func (m *DescriptorMutation) GetColumn() *ColumnDescriptor
- func (m *DescriptorMutation) GetDescriptor_() isDescriptorMutation_Descriptor_
- func (m *DescriptorMutation) GetIndex() *IndexDescriptor
- func (m *DescriptorMutation) Marshal() (data []byte, err error)
- func (m *DescriptorMutation) MarshalTo(data []byte) (int, error)
- func (*DescriptorMutation) ProtoMessage()
- func (m *DescriptorMutation) Reset()
- func (m *DescriptorMutation) Size() (n int)
- func (m *DescriptorMutation) String() string
- func (m *DescriptorMutation) Unmarshal(data []byte) error
- func (*DescriptorMutation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type DescriptorMutation_Column
- type DescriptorMutation_Direction
- type DescriptorMutation_Index
- type DescriptorMutation_State
- type DescriptorProto
- type DescriptorStatus
- type DescriptorVersion
- type Descriptor_Database
- type Descriptor_Table
- type EncDatum
- func (ed *EncDatum) Compare(a *DatumAlloc, rhs *EncDatum) (int, error)
- func (ed *EncDatum) Decode(a *DatumAlloc) error
- func (ed *EncDatum) Encode(a *DatumAlloc, enc DatumEncoding, appendTo []byte) ([]byte, error)
- func (ed *EncDatum) Encoding() (DatumEncoding, bool)
- func (ed *EncDatum) IsUnset() bool
- func (ed *EncDatum) SetDatum(typ ColumnType_Kind, d parser.Datum)
- func (ed *EncDatum) SetEncoded(typ ColumnType_Kind, enc DatumEncoding, val []byte)
- func (ed *EncDatum) SetFromBuffer(typ ColumnType_Kind, enc DatumEncoding, buf []byte) (remaining []byte, err error)
- func (ed *EncDatum) String() string
- type EncDatumRow
- type EncDatumRowAlloc
- type EncDatumRows
- type ErrNonNullViolation
- type ErrRetry
- type ErrTransactionAborted
- type ErrTransactionCommitted
- type ErrUndefinedDatabase
- type ErrUndefinedTable
- type ErrUniquenessConstraintViolation
- type ErrorWithPGCode
- type FamilyID
- type FormatVersion
- type ID
- type IndexDescriptor
- func (desc *IndexDescriptor) ContainsColumnID(colID ColumnID) bool
- func (*IndexDescriptor) Descriptor() ([]byte, []int)
- func (desc *IndexDescriptor) FillColumns(elems parser.IndexElemList) error
- func (desc *IndexDescriptor) FullColumnIDs() ([]ColumnID, []encoding.Direction)
- func (m *IndexDescriptor) Marshal() (data []byte, err error)
- func (m *IndexDescriptor) MarshalTo(data []byte) (int, error)
- func (*IndexDescriptor) ProtoMessage()
- func (m *IndexDescriptor) Reset()
- func (m *IndexDescriptor) Size() (n int)
- func (m *IndexDescriptor) String() string
- func (m *IndexDescriptor) Unmarshal(data []byte) error
- type IndexDescriptor_Direction
- func (x IndexDescriptor_Direction) Enum() *IndexDescriptor_Direction
- func (IndexDescriptor_Direction) EnumDescriptor() ([]byte, []int)
- func (x IndexDescriptor_Direction) String() string
- func (dir IndexDescriptor_Direction) ToEncodingDirection() (encoding.Direction, error)
- func (x *IndexDescriptor_Direction) UnmarshalJSON(data []byte) error
- type IndexEntry
- type IndexID
- type MetadataSchema
- func (ms *MetadataSchema) AddDescriptor(parentID ID, desc DescriptorProto)
- func (ms *MetadataSchema) AddTable(id ID, definition string, privileges privilege.List)
- func (ms MetadataSchema) DescriptorCount() int
- func (ms MetadataSchema) GetInitialValues() []roachpb.KeyValue
- func (ms MetadataSchema) MaxTableID() ID
- func (ms MetadataSchema) TableCount() int
- type MutationID
- type PrivilegeDescriptor
- func (p PrivilegeDescriptor) CheckPrivilege(user string, priv privilege.Kind) bool
- func (*PrivilegeDescriptor) Descriptor() ([]byte, []int)
- func (p *PrivilegeDescriptor) Grant(user string, privList privilege.List)
- func (m *PrivilegeDescriptor) Marshal() (data []byte, err error)
- func (m *PrivilegeDescriptor) MarshalTo(data []byte) (int, error)
- func (*PrivilegeDescriptor) ProtoMessage()
- func (m *PrivilegeDescriptor) Reset()
- func (p *PrivilegeDescriptor) Revoke(user string, privList privilege.List)
- func (p PrivilegeDescriptor) Show() []UserPrivilegeString
- func (m *PrivilegeDescriptor) Size() (n int)
- func (m *PrivilegeDescriptor) String() string
- func (m *PrivilegeDescriptor) Unmarshal(data []byte) error
- func (p PrivilegeDescriptor) Validate(id ID) error
- type RowFetcher
- func (rf *RowFetcher) Init(desc *TableDescriptor, colIdxMap map[ColumnID]int, index *IndexDescriptor, ...) error
- func (rf *RowFetcher) Key() roachpb.Key
- func (rf *RowFetcher) NextKey() (rowDone bool, err error)
- func (rf *RowFetcher) NextKeyDebug() (prettyKey string, prettyValue string, row parser.DTuple, err error)
- func (rf *RowFetcher) NextRow() (parser.DTuple, error)
- func (rf *RowFetcher) ProcessKV(kv client.KeyValue, debugStrings bool) (prettyKey string, prettyValue string, err error)
- func (rf *RowFetcher) ReadIndexKey(k roachpb.Key) (remaining []byte, err error)
- func (rf *RowFetcher) StartScan(txn *client.Txn, spans Spans, limitHint int64) error
- type Span
- type Spans
- type SrcCtx
- type TableAndIndexID
- func (*TableAndIndexID) Descriptor() ([]byte, []int)
- func (t TableAndIndexID) IndexKeyPrefix() []byte
- func (m *TableAndIndexID) Marshal() (data []byte, err error)
- func (m *TableAndIndexID) MarshalTo(data []byte) (int, error)
- func (*TableAndIndexID) ProtoMessage()
- func (m *TableAndIndexID) Reset()
- func (m *TableAndIndexID) Size() (n int)
- func (m *TableAndIndexID) String() string
- func (m *TableAndIndexID) Unmarshal(data []byte) error
- type TableDescriptor
- func (desc *TableDescriptor) AddColumn(col ColumnDescriptor)
- func (desc *TableDescriptor) AddColumnMutation(c ColumnDescriptor, direction DescriptorMutation_Direction)
- func (desc *TableDescriptor) AddFamily(fam ColumnFamilyDescriptor)
- func (desc *TableDescriptor) AddIndex(idx IndexDescriptor, primary bool) error
- func (desc *TableDescriptor) AddIndexMutation(idx IndexDescriptor, direction DescriptorMutation_Direction)
- func (desc *TableDescriptor) AllNonDropIndexes() []IndexDescriptor
- func (desc *TableDescriptor) AllocateIDs() error
- func (desc *TableDescriptor) Deleted() bool
- func (*TableDescriptor) Descriptor() ([]byte, []int)
- func (desc *TableDescriptor) FinalizeMutation() (MutationID, error)
- func (desc *TableDescriptor) FindActiveColumnByID(id ColumnID) (*ColumnDescriptor, error)
- func (desc *TableDescriptor) FindActiveColumnByName(name string) (ColumnDescriptor, error)
- func (desc *TableDescriptor) FindColumnByID(id ColumnID) (*ColumnDescriptor, error)
- func (desc *TableDescriptor) FindColumnByName(name string) (DescriptorStatus, int, error)
- func (desc *TableDescriptor) FindFamilyByID(id FamilyID) (*ColumnFamilyDescriptor, error)
- func (desc *TableDescriptor) FindIndexByID(id IndexID) (*IndexDescriptor, error)
- func (desc *TableDescriptor) FindIndexByName(name string) (DescriptorStatus, int, error)
- func (m *TableDescriptor) GetChecks() []*TableDescriptor_CheckConstraint
- func (m *TableDescriptor) GetColumns() []ColumnDescriptor
- func (m *TableDescriptor) GetFamilies() []ColumnFamilyDescriptor
- func (m *TableDescriptor) GetFormatVersion() FormatVersion
- func (m *TableDescriptor) GetID() ID
- func (m *TableDescriptor) GetIndexes() []IndexDescriptor
- func (m *TableDescriptor) GetLease() *TableDescriptor_SchemaChangeLease
- func (m *TableDescriptor) GetModificationTime() cockroach_util_hlc.Timestamp
- func (m *TableDescriptor) GetMutations() []DescriptorMutation
- func (m *TableDescriptor) GetName() string
- func (m *TableDescriptor) GetNextColumnID() ColumnID
- func (m *TableDescriptor) GetNextFamilyID() FamilyID
- func (m *TableDescriptor) GetNextIndexID() IndexID
- func (m *TableDescriptor) GetNextMutationID() MutationID
- func (m *TableDescriptor) GetParentID() ID
- func (m *TableDescriptor) GetPrimaryIndex() IndexDescriptor
- func (m *TableDescriptor) GetPrivileges() *PrivilegeDescriptor
- func (m *TableDescriptor) GetRenames() []TableDescriptor_RenameInfo
- func (m *TableDescriptor) GetState() TableDescriptor_State
- func (m *TableDescriptor) GetUpVersion() bool
- func (m *TableDescriptor) GetVersion() DescriptorVersion
- func (desc *TableDescriptor) IsEmpty() bool
- func (desc *TableDescriptor) MakeMutationComplete(m DescriptorMutation)
- func (m *TableDescriptor) Marshal() (data []byte, err error)
- func (m *TableDescriptor) MarshalTo(data []byte) (int, error)
- func (desc *TableDescriptor) MaybeUpgradeFormatVersion() bool
- func (*TableDescriptor) ProtoMessage()
- func (desc *TableDescriptor) RemoveColumnFromFamily(colID ColumnID)
- func (desc *TableDescriptor) RenameColumn(colID ColumnID, newColName string)
- func (desc *TableDescriptor) Renamed() bool
- func (m *TableDescriptor) Reset()
- func (desc *TableDescriptor) SetID(id ID)
- func (desc *TableDescriptor) SetName(name string)
- func (desc *TableDescriptor) SetUpVersion() error
- func (m *TableDescriptor) Size() (n int)
- func (m *TableDescriptor) String() string
- func (desc *TableDescriptor) TypeName() string
- func (m *TableDescriptor) Unmarshal(data []byte) error
- func (desc *TableDescriptor) Validate() error
- func (desc *TableDescriptor) VisibleColumns() []ColumnDescriptor
- type TableDescriptor_CheckConstraint
- func (*TableDescriptor_CheckConstraint) Descriptor() ([]byte, []int)
- func (m *TableDescriptor_CheckConstraint) Marshal() (data []byte, err error)
- func (m *TableDescriptor_CheckConstraint) MarshalTo(data []byte) (int, error)
- func (*TableDescriptor_CheckConstraint) ProtoMessage()
- func (m *TableDescriptor_CheckConstraint) Reset()
- func (m *TableDescriptor_CheckConstraint) Size() (n int)
- func (m *TableDescriptor_CheckConstraint) String() string
- func (m *TableDescriptor_CheckConstraint) Unmarshal(data []byte) error
- type TableDescriptor_RenameInfo
- func (*TableDescriptor_RenameInfo) Descriptor() ([]byte, []int)
- func (m *TableDescriptor_RenameInfo) Marshal() (data []byte, err error)
- func (m *TableDescriptor_RenameInfo) MarshalTo(data []byte) (int, error)
- func (*TableDescriptor_RenameInfo) ProtoMessage()
- func (m *TableDescriptor_RenameInfo) Reset()
- func (m *TableDescriptor_RenameInfo) Size() (n int)
- func (m *TableDescriptor_RenameInfo) String() string
- func (m *TableDescriptor_RenameInfo) Unmarshal(data []byte) error
- type TableDescriptor_SchemaChangeLease
- func (*TableDescriptor_SchemaChangeLease) Descriptor() ([]byte, []int)
- func (m *TableDescriptor_SchemaChangeLease) Marshal() (data []byte, err error)
- func (m *TableDescriptor_SchemaChangeLease) MarshalTo(data []byte) (int, error)
- func (*TableDescriptor_SchemaChangeLease) ProtoMessage()
- func (m *TableDescriptor_SchemaChangeLease) Reset()
- func (m *TableDescriptor_SchemaChangeLease) Size() (n int)
- func (m *TableDescriptor_SchemaChangeLease) String() string
- func (m *TableDescriptor_SchemaChangeLease) Unmarshal(data []byte) error
- type TableDescriptor_State
- type UserPrivilegeString
- type UserPrivileges
- func (*UserPrivileges) Descriptor() ([]byte, []int)
- func (m *UserPrivileges) Marshal() (data []byte, err error)
- func (m *UserPrivileges) MarshalTo(data []byte) (int, error)
- func (*UserPrivileges) ProtoMessage()
- func (m *UserPrivileges) Reset()
- func (m *UserPrivileges) Size() (n int)
- func (m *UserPrivileges) String() string
- func (m *UserPrivileges) Unmarshal(data []byte) error
Constants ¶
const (
// PrimaryKeyIndexName is the name of the index for the primary key.
PrimaryKeyIndexName = "primary"
)
Variables ¶
var ( ErrInvalidLengthPrivilege = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPrivilege = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthStructured = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowStructured = fmt.Errorf("proto: integer overflow") )
var ( // SystemDB is the descriptor for the system database. SystemDB = DatabaseDescriptor{ Name: "system", ID: keys.SystemDatabaseID, Privileges: NewPrivilegeDescriptor(security.RootUser, SystemAllowedPrivileges[keys.SystemDatabaseID]), } // DescriptorTable is the descriptor for the descriptor table. DescriptorTable = createSystemTable(keys.DescriptorTableID, descriptorTableSchema) // SystemAllowedPrivileges describes the privileges allowed for each // system object. No user may have more than those privileges, and // the root user must have exactly those privileges. // CREATE|DROP|ALL should always be denied. SystemAllowedPrivileges = map[ID]privilege.List{ keys.SystemDatabaseID: privilege.ReadData, keys.NamespaceTableID: privilege.ReadData, keys.DescriptorTableID: privilege.ReadData, keys.UsersTableID: privilege.ReadWriteData, keys.ZonesTableID: privilege.ReadWriteData, keys.LeaseTableID: privilege.ReadWriteData, keys.RangeEventTableID: privilege.ReadWriteData, keys.UITableID: privilege.ReadWriteData, } // NumSystemDescriptors should be set to the number of system descriptors // above (SystemDB and each system table). This is used by tests which need // to know the number of system descriptors intended for installation; it starts at // 1 for the SystemDB descriptor created above, and is incremented by every // call to createSystemTable(). NumSystemDescriptors = 1 )
var ColumnType_Kind_name = map[int32]string{
0: "BOOL",
1: "INT",
2: "FLOAT",
3: "DECIMAL",
4: "DATE",
5: "TIMESTAMP",
6: "INTERVAL",
7: "STRING",
8: "BYTES",
9: "TIMESTAMPTZ",
}
var ColumnType_Kind_value = map[string]int32{
"BOOL": 0,
"INT": 1,
"FLOAT": 2,
"DECIMAL": 3,
"DATE": 4,
"TIMESTAMP": 5,
"INTERVAL": 6,
"STRING": 7,
"BYTES": 8,
"TIMESTAMPTZ": 9,
}
var DatumEncoding_name = map[int32]string{
0: "ASCENDING_KEY",
1: "DESCENDING_KEY",
2: "VALUE",
}
var DatumEncoding_value = map[string]int32{
"ASCENDING_KEY": 0,
"DESCENDING_KEY": 1,
"VALUE": 2,
}
var DescriptorMutation_Direction_name = map[int32]string{
0: "NONE",
1: "ADD",
2: "DROP",
}
var DescriptorMutation_Direction_value = map[string]int32{
"NONE": 0,
"ADD": 1,
"DROP": 2,
}
var DescriptorMutation_State_name = map[int32]string{
0: "UNKNOWN",
1: "DELETE_ONLY",
2: "WRITE_ONLY",
}
var DescriptorMutation_State_value = map[string]int32{
"UNKNOWN": 0,
"DELETE_ONLY": 1,
"WRITE_ONLY": 2,
}
var ErrMissingColumns = errors.New("table must contain at least 1 column")
ErrMissingColumns indicates a table with no columns.
var ErrMissingPrimaryKey = errors.New("table must contain a primary key")
ErrMissingPrimaryKey indicates a table with no primary key.
var IndexDescriptor_Direction_name = map[int32]string{
0: "ASC",
1: "DESC",
}
var IndexDescriptor_Direction_value = map[string]int32{
"ASC": 0,
"DESC": 1,
}
var TableDescriptor_State_name = map[int32]string{
0: "PUBLIC",
1: "ADD",
2: "DROP",
}
var TableDescriptor_State_value = map[string]int32{
"PUBLIC": 0,
"ADD": 1,
"DROP": 2,
}
Functions ¶
func CheckColumnType ¶
func CheckColumnType(col ColumnDescriptor, val parser.Datum, pmap *parser.PlaceholderInfo) error
CheckColumnType verifies that a given value is compatible with the type requested by the column. If the value is a placeholder, the type of the placeholder gets populated.
func CheckValueWidth ¶
func CheckValueWidth(col ColumnDescriptor, val parser.Datum) error
CheckValueWidth checks that the width (for strings/byte arrays) and scale (for decimals) of the value fits the specified column type. Used by INSERT and UPDATE.
func ColumnsSelectors ¶
func ColumnsSelectors(cols []ColumnDescriptor) parser.SelectExprs
ColumnsSelectors generates Select expressions for cols.
func DecodeIndexKey ¶
func DecodeIndexKey( a *DatumAlloc, desc *TableDescriptor, indexID IndexID, valTypes, vals []parser.Datum, colDirs []encoding.Direction, key []byte, ) ([]byte, error)
DecodeIndexKey decodes the values that are a part of the specified index key. ValTypes is a slice returned from makeKeyVals. The remaining bytes in the index key are returned which will either be an encoded column ID for the primary key index, the primary key suffix for non-unique secondary indexes or unique secondary indexes containing NULL or empty.
func DecodeKeyVals ¶
func DecodeKeyVals(a *DatumAlloc, valTypes, vals []parser.Datum, directions []encoding.Direction, key []byte) ([]byte, error)
DecodeKeyVals decodes the values that are part of the key. ValTypes is a slice returned from makeKeyVals. The decoded values are stored in the vals parameter while the valTypes parameter is unmodified. Note that len(vals) >= len(valTypes). The types of the decoded values will match the corresponding entry in the valTypes parameter with the exception that a value might also be parser.DNull. The remaining bytes in the key after decoding the values are returned. A slice of directions can be provided to enforce encoding direction on each value in valTypes. If this slice is nil, the direction used will default to encoding.Ascending.
func DecodeTableKey ¶
func DecodeTableKey( a *DatumAlloc, valType parser.Datum, key []byte, dir encoding.Direction, ) (parser.Datum, []byte, error)
DecodeTableKey decodes a table key/value.
func DecodeTableValue ¶
DecodeTableValue decodes a value encoded by EncodeTableValue.
func EncodeColumns ¶
func EncodeColumns( columnIDs []ColumnID, directions directions, colMap map[ColumnID]int, values []parser.Datum, keyPrefix []byte, ) (key []byte, containsNull bool, err error)
EncodeColumns is a version of EncodeIndexKey that takes ColumnIDs and directions explicitly.
func EncodeDTuple ¶
EncodeDTuple encodes a DTuple (order-preserving).
func EncodeDatum ¶
EncodeDatum encodes a datum (order-preserving encoding, suitable for keys).
func EncodeIndexKey ¶
func EncodeIndexKey( index *IndexDescriptor, colMap map[ColumnID]int, values []parser.Datum, keyPrefix []byte, ) (key []byte, containsNull bool, err error)
EncodeIndexKey creates a key by concatenating keyPrefix with the encodings of the columns in the index (into a new buffer - does not directly append to keyPrefix).
Returns the key and whether any of the encoded values were NULLs.
Note that ImplicitColumnIDs are not encoded, so the result isn't always a full index key.
func EncodeSecondaryIndexes ¶
func EncodeSecondaryIndexes( tableID ID, indexes []IndexDescriptor, colMap map[ColumnID]int, values []parser.Datum, secondaryIndexEntries []IndexEntry, ) error
EncodeSecondaryIndexes encodes key/values for the secondary indexes. colMap maps ColumnIDs to indices in `values`. secondaryIndexEntries is the return value (passed as a parameter so the caller can reuse between rows) and is expected to be the same length as indexes.
func EncodeTableKey ¶
EncodeTableKey encodes `val` into `b` and returns the new buffer.
func EncodeTableValue ¶
EncodeTableValue encodes `val` into `appendTo` using DatumEncoding_VALUE and returns the new buffer.
func ExtractIndexKey ¶
func ExtractIndexKey( a *DatumAlloc, tableDesc *TableDescriptor, entry client.KeyValue, ) (roachpb.Key, error)
ExtractIndexKey constructs the index (primary) key for a row from any index key/value entry, including secondary indexes.
func IsIntegrityConstraintError ¶
IsIntegrityConstraintError returns true if the error is some kind of SQL constraint violation.
func IsSystemConfigID ¶
IsSystemConfigID returns true if this ID is for a system config object.
func MakeColumnDefDescs ¶
func MakeColumnDefDescs(d *parser.ColumnTableDef) (*ColumnDescriptor, *IndexDescriptor, error)
MakeColumnDefDescs creates the column descriptor for a column, as well as the index descriptor if the column is a primary key or unique.
func MakeDescMetadataKey ¶
MakeDescMetadataKey returns the key for the descriptor.
func MakeIndexKeyPrefix ¶
MakeIndexKeyPrefix returns the key prefix used for the index's data.
func MakeKeyFromEncDatums ¶
func MakeKeyFromEncDatums( values EncDatumRow, directions []IndexDescriptor_Direction, keyPrefix []byte, alloc *DatumAlloc, ) (key roachpb.Key, err error)
MakeKeyFromEncDatums creates a key by concatenating keyPrefix with the encodings of the given EncDatum values.
func MakeKeyVals ¶
func MakeKeyVals( desc *TableDescriptor, columnIDs []ColumnID, ) ([]parser.Datum, error)
MakeKeyVals returns a slice of Datums with the correct types for the given columns.
func MakeNameMetadataKey ¶
MakeNameMetadataKey returns the key for the name. Pass name == "" in order to generate the prefix key to use to scan over all of the names for the specified parentID.
func MakeZoneKey ¶
MakeZoneKey returns the key for 'id's entry in the system.zones table.
func MarshalColumnValue ¶
MarshalColumnValue returns a Go primitive value equivalent of val, of the type expected by col. If val's type is incompatible with col, or if col's type is not yet implemented, an error is returned.
func NewNonNullViolationError ¶
NewNonNullViolationError creates a new ErrNonNullViolation.
func NewTransactionAbortedError ¶
NewTransactionAbortedError creates a new ErrTransactionAborted.
func NewTransactionCommittedError ¶
func NewTransactionCommittedError() error
NewTransactionCommittedError creates a new ErrTransactionCommitted.
func NewUndefinedDatabaseError ¶
NewUndefinedDatabaseError creates a new ErrUndefinedDatabase.
func NewUndefinedTableError ¶
NewUndefinedTableError creates a new ErrUndefinedTable.
func NewUniquenessConstraintViolationError ¶
func NewUniquenessConstraintViolationError( index *IndexDescriptor, vals []parser.Datum, ) error
NewUniquenessConstraintViolationError creates a new ErrUniquenessConstrainViolation.
func NormalizeName ¶
NormalizeName normalizes to lowercase and Unicode Normalization Form C (NFC).
func PrettySpan ¶
PrettySpan returns a human-readable representation of a span.
func PrettySpans ¶
PrettySpans returns a human-readable description of the spans.
func RandDatum ¶
RandDatum generates a random Datum of the given type. If null is true, the datum can be DNull.
func SanitizeVarFreeExpr ¶
SanitizeVarFreeExpr verifies a default expression is valid, has the correct type and contains no variable expressions.
func SetKVBatchSize ¶
func SetKVBatchSize(val int64) func()
SetKVBatchSize changes the kvFetcher batch size, and returns a function that restores it.
func UnmarshalColumnValue ¶
func UnmarshalColumnValue( a *DatumAlloc, kind ColumnType_Kind, value *roachpb.Value, ) (parser.Datum, error)
UnmarshalColumnValue decodes the value from a key-value pair using the type expected by the column. An error is returned if the value's type does not match the column's type.
Types ¶
type ColumnDescriptor ¶
type ColumnDescriptor struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name"` ID ColumnID `protobuf:"varint,2,opt,name=id,casttype=ColumnID" json:"id"` Type ColumnType `protobuf:"bytes,3,opt,name=type" json:"type"` Nullable bool `protobuf:"varint,4,opt,name=nullable" json:"nullable"` NullableConstraintName string `protobuf:"bytes,8,opt,name=nullable_constraint_name,json=nullableConstraintName" json:"nullable_constraint_name"` // Default expression to use to populate the column on insert if no // value is provided. DefaultExpr *string `protobuf:"bytes,5,opt,name=default_expr,json=defaultExpr" json:"default_expr,omitempty"` DefaultExprConstraintName string `protobuf:"bytes,9,opt,name=default_expr_constraint_name,json=defaultExprConstraintName" json:"default_expr_constraint_name"` Hidden bool `protobuf:"varint,6,opt,name=hidden" json:"hidden"` }
func (*ColumnDescriptor) Descriptor ¶
func (*ColumnDescriptor) Descriptor() ([]byte, []int)
func (*ColumnDescriptor) Marshal ¶
func (m *ColumnDescriptor) Marshal() (data []byte, err error)
func (*ColumnDescriptor) ProtoMessage ¶
func (*ColumnDescriptor) ProtoMessage()
func (*ColumnDescriptor) Reset ¶
func (m *ColumnDescriptor) Reset()
func (*ColumnDescriptor) Size ¶
func (m *ColumnDescriptor) Size() (n int)
func (*ColumnDescriptor) String ¶
func (m *ColumnDescriptor) String() string
func (*ColumnDescriptor) Unmarshal ¶
func (m *ColumnDescriptor) Unmarshal(data []byte) error
type ColumnFamilyDescriptor ¶
type ColumnFamilyDescriptor struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name"` ID FamilyID `protobuf:"varint,2,opt,name=id,casttype=FamilyID" json:"id"` // A list of column names of which the family is comprised. This list // parallels the column_ids list. If duplicating the storage of the column // names here proves to be prohibitive, we could clear this field before // saving and reconstruct it after loading. ColumnNames []string `protobuf:"bytes,3,rep,name=column_names,json=columnNames" json:"column_names,omitempty"` // A list of column ids of which the family is comprised. This list parallels // the column_names list. ColumnIDs []ColumnID `protobuf:"varint,4,rep,name=column_ids,json=columnIds,casttype=ColumnID" json:"column_ids,omitempty"` // If nonzero, the column involved in the single column optimization. // // Families store colums in a ValueType_TUPLE as repeated <colid><data> // entries. As a space optimization and for backward compatibility, a single // column is written without the columnid prefix. Because more columns could // be added, it would be ambiguous which column was stored when read back in, // so this field supplies it. DefaultColumnID ColumnID `protobuf:"varint,5,opt,name=default_column_id,json=defaultColumnId,casttype=ColumnID" json:"default_column_id"` }
ColumnFamilyDescriptor is set of columns stored together in one kv entry.
func (*ColumnFamilyDescriptor) Descriptor ¶
func (*ColumnFamilyDescriptor) Descriptor() ([]byte, []int)
func (*ColumnFamilyDescriptor) Marshal ¶
func (m *ColumnFamilyDescriptor) Marshal() (data []byte, err error)
func (*ColumnFamilyDescriptor) MarshalTo ¶
func (m *ColumnFamilyDescriptor) MarshalTo(data []byte) (int, error)
func (*ColumnFamilyDescriptor) ProtoMessage ¶
func (*ColumnFamilyDescriptor) ProtoMessage()
func (*ColumnFamilyDescriptor) Reset ¶
func (m *ColumnFamilyDescriptor) Reset()
func (*ColumnFamilyDescriptor) Size ¶
func (m *ColumnFamilyDescriptor) Size() (n int)
func (*ColumnFamilyDescriptor) String ¶
func (m *ColumnFamilyDescriptor) String() string
func (*ColumnFamilyDescriptor) Unmarshal ¶
func (m *ColumnFamilyDescriptor) Unmarshal(data []byte) error
type ColumnOrderInfo ¶
ColumnOrderInfo describes a column (as an index) and a desired order direction.
type ColumnOrdering ¶
type ColumnOrdering []ColumnOrderInfo
ColumnOrdering is used to describe a desired column ordering. For example,
[]ColumnOrderInfo{ {3, true}, {1, false} }
represents an ordering first by column 3 (descending), then by column 1 (ascending).
type ColumnType ¶
type ColumnType struct { Kind ColumnType_Kind `protobuf:"varint,1,opt,name=kind,enum=cockroach.sql.sqlbase.ColumnType_Kind" json:"kind"` // BIT, INT, FLOAT, DECIMAL, CHAR and BINARY Width int32 `protobuf:"varint,2,opt,name=width" json:"width"` // FLOAT and DECIMAL. Precision int32 `protobuf:"varint,3,opt,name=precision" json:"precision"` }
func (*ColumnType) Descriptor ¶
func (*ColumnType) Descriptor() ([]byte, []int)
func (*ColumnType) Marshal ¶
func (m *ColumnType) Marshal() (data []byte, err error)
func (*ColumnType) ProtoMessage ¶
func (*ColumnType) ProtoMessage()
func (*ColumnType) Reset ¶
func (m *ColumnType) Reset()
func (*ColumnType) SQLString ¶
func (c *ColumnType) SQLString() string
SQLString returns the SQL string corresponding to the type.
func (*ColumnType) Size ¶
func (m *ColumnType) Size() (n int)
func (*ColumnType) String ¶
func (m *ColumnType) String() string
func (*ColumnType) ToDatumType ¶
func (c *ColumnType) ToDatumType() parser.Datum
ToDatumType converts the ColumnType to the correct type Datum, or nil if there is no correspondence.
func (*ColumnType) Unmarshal ¶
func (m *ColumnType) Unmarshal(data []byte) error
type ColumnType_Kind ¶
type ColumnType_Kind int32
These mirror the types supported by the sql/parser. See sql/parser/types.go.
const ( ColumnType_BOOL ColumnType_Kind = 0 ColumnType_INT ColumnType_Kind = 1 ColumnType_FLOAT ColumnType_Kind = 2 ColumnType_DECIMAL ColumnType_Kind = 3 ColumnType_DATE ColumnType_Kind = 4 ColumnType_TIMESTAMP ColumnType_Kind = 5 ColumnType_INTERVAL ColumnType_Kind = 6 ColumnType_STRING ColumnType_Kind = 7 ColumnType_BYTES ColumnType_Kind = 8 ColumnType_TIMESTAMPTZ ColumnType_Kind = 9 )
func RandColumnType ¶
func RandColumnType(rng *rand.Rand) ColumnType_Kind
RandColumnType returns a random ColumnType_Kind value.
func (ColumnType_Kind) Enum ¶
func (x ColumnType_Kind) Enum() *ColumnType_Kind
func (ColumnType_Kind) EnumDescriptor ¶
func (ColumnType_Kind) EnumDescriptor() ([]byte, []int)
func (ColumnType_Kind) String ¶
func (x ColumnType_Kind) String() string
func (ColumnType_Kind) ToDatumType ¶
func (k ColumnType_Kind) ToDatumType() parser.Datum
ToDatumType converts the ColumnType_Kind to the correct type Datum, or nil if there is no correspondence.
func (*ColumnType_Kind) UnmarshalJSON ¶
func (x *ColumnType_Kind) UnmarshalJSON(data []byte) error
type DatabaseDescriptor ¶
type DatabaseDescriptor struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name"` ID ID `protobuf:"varint,2,opt,name=id,casttype=ID" json:"id"` Privileges *PrivilegeDescriptor `protobuf:"bytes,3,opt,name=privileges" json:"privileges,omitempty"` }
DatabaseDescriptor represents a namespace (aka database) and is stored in a structured metadata key. The DatabaseDescriptor has a globally-unique ID shared with the TableDescriptor ID. Permissions are applied to all tables in the namespace.
func (*DatabaseDescriptor) Descriptor ¶
func (*DatabaseDescriptor) Descriptor() ([]byte, []int)
func (*DatabaseDescriptor) GetID ¶
func (m *DatabaseDescriptor) GetID() ID
func (*DatabaseDescriptor) GetName ¶
func (m *DatabaseDescriptor) GetName() string
func (*DatabaseDescriptor) GetPrivileges ¶
func (m *DatabaseDescriptor) GetPrivileges() *PrivilegeDescriptor
func (*DatabaseDescriptor) Marshal ¶
func (m *DatabaseDescriptor) Marshal() (data []byte, err error)
func (*DatabaseDescriptor) MarshalTo ¶
func (m *DatabaseDescriptor) MarshalTo(data []byte) (int, error)
func (*DatabaseDescriptor) ProtoMessage ¶
func (*DatabaseDescriptor) ProtoMessage()
func (*DatabaseDescriptor) Reset ¶
func (m *DatabaseDescriptor) Reset()
func (*DatabaseDescriptor) SetID ¶
func (desc *DatabaseDescriptor) SetID(id ID)
SetID implements the DescriptorProto interface.
func (*DatabaseDescriptor) SetName ¶
func (desc *DatabaseDescriptor) SetName(name string)
SetName implements the DescriptorProto interface.
func (*DatabaseDescriptor) Size ¶
func (m *DatabaseDescriptor) Size() (n int)
func (*DatabaseDescriptor) String ¶
func (m *DatabaseDescriptor) String() string
func (*DatabaseDescriptor) TypeName ¶
func (desc *DatabaseDescriptor) TypeName() string
TypeName returns the plain type of this descriptor.
func (*DatabaseDescriptor) Unmarshal ¶
func (m *DatabaseDescriptor) Unmarshal(data []byte) error
func (*DatabaseDescriptor) Validate ¶
func (desc *DatabaseDescriptor) Validate() error
Validate validates that the database descriptor is well formed. Checks include validate the database name, and verifying that there is at least one read and write user.
type DatumAlloc ¶
type DatumAlloc struct {
// contains filtered or unexported fields
}
DatumAlloc provides batch allocation of datum pointers, amortizing the cost of the allocations.
func (*DatumAlloc) NewDBytes ¶
func (a *DatumAlloc) NewDBytes(v parser.DBytes) *parser.DBytes
NewDBytes allocates a DBytes.
func (*DatumAlloc) NewDDate ¶
func (a *DatumAlloc) NewDDate(v parser.DDate) *parser.DDate
NewDDate allocates a DDate.
func (*DatumAlloc) NewDDecimal ¶
func (a *DatumAlloc) NewDDecimal(v parser.DDecimal) *parser.DDecimal
NewDDecimal allocates a DDecimal.
func (*DatumAlloc) NewDFloat ¶
func (a *DatumAlloc) NewDFloat(v parser.DFloat) *parser.DFloat
NewDFloat allocates a DFloat.
func (*DatumAlloc) NewDInt ¶
func (a *DatumAlloc) NewDInt(v parser.DInt) *parser.DInt
NewDInt allocates a DInt.
func (*DatumAlloc) NewDInterval ¶
func (a *DatumAlloc) NewDInterval(v parser.DInterval) *parser.DInterval
NewDInterval allocates a DInterval.
func (*DatumAlloc) NewDString ¶
func (a *DatumAlloc) NewDString(v parser.DString) *parser.DString
NewDString allocates a DString.
func (*DatumAlloc) NewDTimestamp ¶
func (a *DatumAlloc) NewDTimestamp(v parser.DTimestamp) *parser.DTimestamp
NewDTimestamp allocates a DTimestamp.
func (*DatumAlloc) NewDTimestampTZ ¶
func (a *DatumAlloc) NewDTimestampTZ(v parser.DTimestampTZ) *parser.DTimestampTZ
NewDTimestampTZ allocates a DTimestampTZ.
type DatumEncoding ¶
type DatumEncoding int32
DatumEncoding identifies the encoding used for an EncDatum.
const ( // Indicates that the datum is encoded using the order-preserving encoding // used for keys (ascending order). DatumEncoding_ASCENDING_KEY DatumEncoding = 0 // Indicates that the datum is encoded using the order-preserving encoding // used for keys (descending order). DatumEncoding_DESCENDING_KEY DatumEncoding = 1 // Indicates that the datum is encoded using the encoding used for values. DatumEncoding_VALUE DatumEncoding = 2 )
func RandDatumEncoding ¶
func RandDatumEncoding(rng *rand.Rand) DatumEncoding
RandDatumEncoding returns a random DatumEncoding value.
func (DatumEncoding) Enum ¶
func (x DatumEncoding) Enum() *DatumEncoding
func (DatumEncoding) EnumDescriptor ¶
func (DatumEncoding) EnumDescriptor() ([]byte, []int)
func (DatumEncoding) String ¶
func (x DatumEncoding) String() string
func (*DatumEncoding) UnmarshalJSON ¶
func (x *DatumEncoding) UnmarshalJSON(data []byte) error
type Descriptor ¶
type Descriptor struct { // Types that are valid to be assigned to Union: // *Descriptor_Table // *Descriptor_Database Union isDescriptor_Union `protobuf_oneof:"union"` }
Descriptor is a union type holding either a table or database descriptor.
func WrapDescriptor ¶
func WrapDescriptor(descriptor DescriptorProto) *Descriptor
WrapDescriptor fills in a Descriptor.
func (*Descriptor) Descriptor ¶
func (*Descriptor) Descriptor() ([]byte, []int)
func (*Descriptor) GetDatabase ¶
func (m *Descriptor) GetDatabase() *DatabaseDescriptor
func (*Descriptor) GetID ¶
func (desc *Descriptor) GetID() ID
GetID returns the ID of the descriptor.
func (*Descriptor) GetName ¶
func (desc *Descriptor) GetName() string
GetName returns the Name of the descriptor.
func (*Descriptor) GetTable ¶
func (m *Descriptor) GetTable() *TableDescriptor
func (*Descriptor) GetUnion ¶
func (m *Descriptor) GetUnion() isDescriptor_Union
func (*Descriptor) Marshal ¶
func (m *Descriptor) Marshal() (data []byte, err error)
func (*Descriptor) ProtoMessage ¶
func (*Descriptor) ProtoMessage()
func (*Descriptor) Reset ¶
func (m *Descriptor) Reset()
func (*Descriptor) Size ¶
func (m *Descriptor) Size() (n int)
func (*Descriptor) String ¶
func (m *Descriptor) String() string
func (*Descriptor) Unmarshal ¶
func (m *Descriptor) Unmarshal(data []byte) error
func (*Descriptor) XXX_OneofFuncs ¶
func (*Descriptor) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type DescriptorKey ¶
DescriptorKey is the interface implemented by both databaseKey and tableKey. It is used to easily get the descriptor key and plain name.
type DescriptorMutation ¶
type DescriptorMutation struct { // Types that are valid to be assigned to Descriptor_: // *DescriptorMutation_Column // *DescriptorMutation_Index Descriptor_ isDescriptorMutation_Descriptor_ `protobuf_oneof:"descriptor"` State DescriptorMutation_State `protobuf:"varint,3,opt,name=state,enum=cockroach.sql.sqlbase.DescriptorMutation_State" json:"state"` Direction DescriptorMutation_Direction `protobuf:"varint,4,opt,name=direction,enum=cockroach.sql.sqlbase.DescriptorMutation_Direction" json:"direction"` // The mutation id used to group mutations that should be applied together. // This is used for situations like creating a unique column, which // involve adding two mutations: one for the column, and another for the // unique constraint index. MutationID MutationID `protobuf:"varint,5,opt,name=mutation_id,json=mutationId,casttype=MutationID" json:"mutation_id"` }
A DescriptorMutation represents a column or an index that has either been added or dropped and hasn't yet transitioned into a stable state: completely backfilled and visible, or completely deleted. A table descriptor in the middle of a schema change will have a DescriptorMutation FIFO queue containing each column/index descriptor being added or dropped.
func (*DescriptorMutation) Descriptor ¶
func (*DescriptorMutation) Descriptor() ([]byte, []int)
func (*DescriptorMutation) GetColumn ¶
func (m *DescriptorMutation) GetColumn() *ColumnDescriptor
func (*DescriptorMutation) GetDescriptor_ ¶
func (m *DescriptorMutation) GetDescriptor_() isDescriptorMutation_Descriptor_
func (*DescriptorMutation) GetIndex ¶
func (m *DescriptorMutation) GetIndex() *IndexDescriptor
func (*DescriptorMutation) Marshal ¶
func (m *DescriptorMutation) Marshal() (data []byte, err error)
func (*DescriptorMutation) MarshalTo ¶
func (m *DescriptorMutation) MarshalTo(data []byte) (int, error)
func (*DescriptorMutation) ProtoMessage ¶
func (*DescriptorMutation) ProtoMessage()
func (*DescriptorMutation) Reset ¶
func (m *DescriptorMutation) Reset()
func (*DescriptorMutation) Size ¶
func (m *DescriptorMutation) Size() (n int)
func (*DescriptorMutation) String ¶
func (m *DescriptorMutation) String() string
func (*DescriptorMutation) Unmarshal ¶
func (m *DescriptorMutation) Unmarshal(data []byte) error
func (*DescriptorMutation) XXX_OneofFuncs ¶
func (*DescriptorMutation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type DescriptorMutation_Column ¶
type DescriptorMutation_Column struct {
Column *ColumnDescriptor `protobuf:"bytes,1,opt,name=column,oneof"`
}
func (*DescriptorMutation_Column) MarshalTo ¶
func (m *DescriptorMutation_Column) MarshalTo(data []byte) (int, error)
func (*DescriptorMutation_Column) Size ¶
func (m *DescriptorMutation_Column) Size() (n int)
type DescriptorMutation_Direction ¶
type DescriptorMutation_Direction int32
Direction of mutation.
const ( // Not used. DescriptorMutation_NONE DescriptorMutation_Direction = 0 // Descriptor is being added. DescriptorMutation_ADD DescriptorMutation_Direction = 1 // Descriptor is being dropped. DescriptorMutation_DROP DescriptorMutation_Direction = 2 )
func (DescriptorMutation_Direction) Enum ¶
func (x DescriptorMutation_Direction) Enum() *DescriptorMutation_Direction
func (DescriptorMutation_Direction) EnumDescriptor ¶
func (DescriptorMutation_Direction) EnumDescriptor() ([]byte, []int)
func (DescriptorMutation_Direction) String ¶
func (x DescriptorMutation_Direction) String() string
func (*DescriptorMutation_Direction) UnmarshalJSON ¶
func (x *DescriptorMutation_Direction) UnmarshalJSON(data []byte) error
type DescriptorMutation_Index ¶
type DescriptorMutation_Index struct {
Index *IndexDescriptor `protobuf:"bytes,2,opt,name=index,oneof"`
}
func (*DescriptorMutation_Index) MarshalTo ¶
func (m *DescriptorMutation_Index) MarshalTo(data []byte) (int, error)
func (*DescriptorMutation_Index) Size ¶
func (m *DescriptorMutation_Index) Size() (n int)
type DescriptorMutation_State ¶
type DescriptorMutation_State int32
A descriptor within a mutation is unavailable for reads, writes and deletes. It is only available for implicit (internal to the database) writes and deletes depending on the state of the mutation.
const ( // Not used. DescriptorMutation_UNKNOWN DescriptorMutation_State = 0 // Operations can use this invisible descriptor to implicitly // delete entries. // Column: A descriptor in this state is invisible to // INSERT and UPDATE. DELETE must delete a column in this state. // Index: A descriptor in this state is invisible to an INSERT. // UPDATE must delete the old value of the index but doesn't write // the new value. DELETE must delete the index. // // When deleting a descriptor, all descriptor related data // (column or index data) can only be mass deleted once // all the nodes have transitioned to the DELETE_ONLY state. DescriptorMutation_DELETE_ONLY DescriptorMutation_State = 1 // Operations can use this invisible descriptor to implicitly // write and delete entries. // Column: INSERT will populate this column with the default // value. UPDATE ignores this descriptor. DELETE must delete // the column. // Index: INSERT, UPDATE and DELETE treat this index like any // other index. // // When adding a descriptor, all descriptor related data // (column default or index data) can only be backfilled once // all nodes have transitioned into the WRITE_ONLY state. DescriptorMutation_WRITE_ONLY DescriptorMutation_State = 2 )
func (DescriptorMutation_State) Enum ¶
func (x DescriptorMutation_State) Enum() *DescriptorMutation_State
func (DescriptorMutation_State) EnumDescriptor ¶
func (DescriptorMutation_State) EnumDescriptor() ([]byte, []int)
func (DescriptorMutation_State) String ¶
func (x DescriptorMutation_State) String() string
func (*DescriptorMutation_State) UnmarshalJSON ¶
func (x *DescriptorMutation_State) UnmarshalJSON(data []byte) error
type DescriptorProto ¶
type DescriptorProto interface { proto.Message GetPrivileges() *PrivilegeDescriptor GetID() ID SetID(ID) TypeName() string GetName() string SetName(string) Validate() error }
DescriptorProto is the interface implemented by both DatabaseDescriptor and TableDescriptor. TODO(marc): this is getting rather large.
type DescriptorStatus ¶
type DescriptorStatus int
DescriptorStatus is the status for a descriptor.
const ( // DescriptorAbsent for a descriptor that doesn't exist. DescriptorAbsent DescriptorStatus // DescriptorIncomplete for a descriptor that is a part of a // schema change, and is still being processed. DescriptorIncomplete // DescriptorActive for a descriptor that is completely active // for read/write and delete operations. DescriptorActive )
type DescriptorVersion ¶
type DescriptorVersion uint32
DescriptorVersion is a custom type for TableDescriptor Versions.
type Descriptor_Database ¶
type Descriptor_Database struct {
Database *DatabaseDescriptor `protobuf:"bytes,2,opt,name=database,oneof"`
}
func (*Descriptor_Database) MarshalTo ¶
func (m *Descriptor_Database) MarshalTo(data []byte) (int, error)
func (*Descriptor_Database) Size ¶
func (m *Descriptor_Database) Size() (n int)
type Descriptor_Table ¶
type Descriptor_Table struct {
Table *TableDescriptor `protobuf:"bytes,1,opt,name=table,oneof"`
}
func (*Descriptor_Table) Size ¶
func (m *Descriptor_Table) Size() (n int)
type EncDatum ¶
type EncDatum struct { Type ColumnType_Kind // Decoded datum. Datum parser.Datum // contains filtered or unexported fields }
EncDatum represents a datum that is "backed" by an encoding and/or by a parser.Datum. It allows "passing through" a Datum without decoding and reencoding. TODO(radu): It will also allow comparing encoded datums directly (for certain encodings).
func RandEncDatum ¶
RandEncDatum generates a random EncDatum (of a random type).
func (*EncDatum) Compare ¶
func (ed *EncDatum) Compare(a *DatumAlloc, rhs *EncDatum) (int, error)
Compare returns:
-1 if the receiver is less than rhs, 0 if the receiver is equal to rhs, +1 if the receiver is greater than rhs.
func (*EncDatum) Decode ¶
func (ed *EncDatum) Decode(a *DatumAlloc) error
Decode ensures that Datum is set (decoding if necessary).
func (*EncDatum) Encode ¶
func (ed *EncDatum) Encode(a *DatumAlloc, enc DatumEncoding, appendTo []byte) ([]byte, error)
Encode appends the encoded datum to the given slice using the requested encoding.
func (*EncDatum) Encoding ¶
func (ed *EncDatum) Encoding() (DatumEncoding, bool)
Encoding returns the encoding that is already available (the latter indicated by the bool return value).
func (*EncDatum) SetDatum ¶
func (ed *EncDatum) SetDatum(typ ColumnType_Kind, d parser.Datum)
SetDatum initializes the EncDatum with the given Datum.
func (*EncDatum) SetEncoded ¶
func (ed *EncDatum) SetEncoded(typ ColumnType_Kind, enc DatumEncoding, val []byte)
SetEncoded initializes the EncDatum with the given encoded value. The encoded value is stored as a shallow copy, so the caller must make sure the slice is not modified for the lifetime of the EncDatum.
func (*EncDatum) SetFromBuffer ¶
func (ed *EncDatum) SetFromBuffer( typ ColumnType_Kind, enc DatumEncoding, buf []byte, ) (remaining []byte, err error)
SetFromBuffer initializes the EncDatum with an encoding that is possibly followed by other data. Similar to SetEncoded, except that this function figures out where the encoding stops and returns a slice for the rest of the buffer.
type EncDatumRow ¶
type EncDatumRow []EncDatum
EncDatumRow is a row of EncDatums.
func (EncDatumRow) Compare ¶
func (r EncDatumRow) Compare(a *DatumAlloc, ordering ColumnOrdering, rhs EncDatumRow) (int, error)
Compare returns the relative ordering of two EncDatumRows according to a ColumnOrdering:
-1 if the receiver comes before the rhs in the ordering, +1 if the receiver comes after the rhs in the ordering, 0 if the relative order does not matter (i.e. the two rows have the same values for the columns in the ordering).
Note that a return value of 0 does not (in general) imply that the rows are equal; for example, rows [1 1 5] and [1 1 6] when compared against ordering {{0, asc}, {1, asc}} (i.e. ordered by first column and then by second column).
func (EncDatumRow) String ¶
func (r EncDatumRow) String() string
type EncDatumRowAlloc ¶
type EncDatumRowAlloc struct {
// contains filtered or unexported fields
}
EncDatumRowAlloc is a helper that speeds up allocation of EncDatumRows (preferably of the same length).
func (*EncDatumRowAlloc) AllocRow ¶
func (a *EncDatumRowAlloc) AllocRow(cols int) EncDatumRow
AllocRow allocates an EncDatumRow with the given number of columns.
func (*EncDatumRowAlloc) CopyRow ¶
func (a *EncDatumRowAlloc) CopyRow(row EncDatumRow) EncDatumRow
CopyRow allocates an EncDatumRow and copies the given row to it.
type EncDatumRows ¶
type EncDatumRows []EncDatumRow
EncDatumRows is a slice of EncDatumRows.
func (EncDatumRows) String ¶
func (r EncDatumRows) String() string
type ErrNonNullViolation ¶
type ErrNonNullViolation struct {
// contains filtered or unexported fields
}
ErrNonNullViolation represents a violation of a non-NULL constraint.
func (*ErrNonNullViolation) Code ¶
func (*ErrNonNullViolation) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrNonNullViolation) Error ¶
func (e *ErrNonNullViolation) Error() string
func (*ErrNonNullViolation) SrcContext ¶
func (e *ErrNonNullViolation) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrRetry ¶
type ErrRetry struct {
// contains filtered or unexported fields
}
ErrRetry means that the transaction can be retried. It signals to the user that the SQL txn entered the RESTART_WAIT state after a serialization error, and that a ROLLBACK TO SAVEPOINT COCKROACH_RESTART statement should be issued.
func (*ErrRetry) SrcContext ¶
SrcContext implements the ErrorWithPGCode interface.
type ErrTransactionAborted ¶
type ErrTransactionAborted struct { CustomMsg string // contains filtered or unexported fields }
ErrTransactionAborted represents an error for trying to run a command in the context of transaction that's already aborted.
func (*ErrTransactionAborted) Code ¶
func (*ErrTransactionAborted) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrTransactionAborted) Error ¶
func (e *ErrTransactionAborted) Error() string
func (*ErrTransactionAborted) SrcContext ¶
func (e *ErrTransactionAborted) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrTransactionCommitted ¶
type ErrTransactionCommitted struct {
// contains filtered or unexported fields
}
ErrTransactionCommitted signals that the SQL txn is in the COMMIT_WAIT state and that only a COMMIT statement will be accepted.
func (*ErrTransactionCommitted) Code ¶
func (*ErrTransactionCommitted) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrTransactionCommitted) Error ¶
func (*ErrTransactionCommitted) Error() string
func (*ErrTransactionCommitted) SrcContext ¶
func (e *ErrTransactionCommitted) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrUndefinedDatabase ¶
type ErrUndefinedDatabase struct {
// contains filtered or unexported fields
}
ErrUndefinedDatabase represents a missing database error.
func (*ErrUndefinedDatabase) Code ¶
func (*ErrUndefinedDatabase) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrUndefinedDatabase) Error ¶
func (e *ErrUndefinedDatabase) Error() string
func (*ErrUndefinedDatabase) SrcContext ¶
func (e *ErrUndefinedDatabase) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrUndefinedTable ¶
type ErrUndefinedTable struct {
// contains filtered or unexported fields
}
ErrUndefinedTable represents a missing database table.
func (*ErrUndefinedTable) Code ¶
func (*ErrUndefinedTable) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrUndefinedTable) Error ¶
func (e *ErrUndefinedTable) Error() string
func (*ErrUndefinedTable) SrcContext ¶
func (e *ErrUndefinedTable) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrUniquenessConstraintViolation ¶
type ErrUniquenessConstraintViolation struct {
// contains filtered or unexported fields
}
ErrUniquenessConstraintViolation represents a violation of a UNIQUE constraint.
func (*ErrUniquenessConstraintViolation) Code ¶
func (*ErrUniquenessConstraintViolation) Code() string
Code implements the ErrorWithPGCode interface.
func (*ErrUniquenessConstraintViolation) Error ¶
func (e *ErrUniquenessConstraintViolation) Error() string
func (*ErrUniquenessConstraintViolation) SrcContext ¶
func (e *ErrUniquenessConstraintViolation) SrcContext() SrcCtx
SrcContext implements the ErrorWithPGCode interface.
type ErrorWithPGCode ¶
ErrorWithPGCode represents errors that carries an error code to the user. pgwire recognizes this interfaces and extracts the code.
type FormatVersion ¶
type FormatVersion uint32
FormatVersion is a custom type for TableDescriptor versions of the sql to key:value mapping.
const ( // BaseFormatVersion corresponds to the encoding described in // https://www.cockroachlabs.com/blog/sql-in-cockroachdb-mapping-table-data-to-key-value-storage/. BaseFormatVersion FormatVersion // FamilyFormatVersion corresponds to the encoding described in // https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/sql_column_families.md FamilyFormatVersion )
func (FormatVersion) String ¶
func (i FormatVersion) String() string
type IndexDescriptor ¶
type IndexDescriptor struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name"` ID IndexID `protobuf:"varint,2,opt,name=id,casttype=IndexID" json:"id"` Unique bool `protobuf:"varint,3,opt,name=unique" json:"unique"` // An ordered list of column names of which the index is comprised. This list // parallels the column_ids list. If duplicating the storage of the column // names here proves to be prohibitive, we could clear this field before // saving and reconstruct it after loading. ColumnNames []string `protobuf:"bytes,4,rep,name=column_names,json=columnNames" json:"column_names,omitempty"` // Parallel with column_names - the sort direction of each column. ColumnDirections []IndexDescriptor_Direction `` /* 156-byte string literal not displayed */ // An ordered list of column names which the index stores in // addition to the columns which are explicitly part of the index. StoreColumnNames []string `protobuf:"bytes,5,rep,name=store_column_names,json=storeColumnNames" json:"store_column_names,omitempty"` // An ordered list of column ids of which the index is comprised. This list // parallels the column_names list. ColumnIDs []ColumnID `protobuf:"varint,6,rep,name=column_ids,json=columnIds,casttype=ColumnID" json:"column_ids,omitempty"` // An ordered list of implicit column ids associated with the index. For // non-unique indexes, these columns will be appended to the key. For unique // indexes these columns will be stored in the value. The extra column IDs is // computed as PrimaryIndex.column_ids - column_ids. For the primary index // the list will be empty. // The distinction about whether the columns are written in the key or the value // comes because we want to always do writes using a single operation - this // way for unique indexes we can do a conditional put on the key. ImplicitColumnIDs []ColumnID `` /* 126-byte string literal not displayed */ ForeignKey *TableAndIndexID `protobuf:"bytes,9,opt,name=foreign_key,json=foreignKey" json:"foreign_key,omitempty"` ReferencedBy []*TableAndIndexID `protobuf:"bytes,10,rep,name=referenced_by,json=referencedBy" json:"referenced_by,omitempty"` }
func (*IndexDescriptor) ContainsColumnID ¶
func (desc *IndexDescriptor) ContainsColumnID(colID ColumnID) bool
ContainsColumnID returns true if the index descriptor contains the specified column ID either in its explicit column IDs or the implicit "extra" column IDs.
func (*IndexDescriptor) Descriptor ¶
func (*IndexDescriptor) Descriptor() ([]byte, []int)
func (*IndexDescriptor) FillColumns ¶
func (desc *IndexDescriptor) FillColumns(elems parser.IndexElemList) error
FillColumns sets the column names and directions in desc.
func (*IndexDescriptor) FullColumnIDs ¶
func (desc *IndexDescriptor) FullColumnIDs() ([]ColumnID, []encoding.Direction)
FullColumnIDs returns the index column IDs including any implicit column IDs for non-unique indexes. It also returns the direction with which each column was encoded.
func (*IndexDescriptor) Marshal ¶
func (m *IndexDescriptor) Marshal() (data []byte, err error)
func (*IndexDescriptor) ProtoMessage ¶
func (*IndexDescriptor) ProtoMessage()
func (*IndexDescriptor) Reset ¶
func (m *IndexDescriptor) Reset()
func (*IndexDescriptor) Size ¶
func (m *IndexDescriptor) Size() (n int)
func (*IndexDescriptor) String ¶
func (m *IndexDescriptor) String() string
func (*IndexDescriptor) Unmarshal ¶
func (m *IndexDescriptor) Unmarshal(data []byte) error
type IndexDescriptor_Direction ¶
type IndexDescriptor_Direction int32
The direction of a column in the index.
const ( IndexDescriptor_ASC IndexDescriptor_Direction = 0 IndexDescriptor_DESC IndexDescriptor_Direction = 1 )
func (IndexDescriptor_Direction) Enum ¶
func (x IndexDescriptor_Direction) Enum() *IndexDescriptor_Direction
func (IndexDescriptor_Direction) EnumDescriptor ¶
func (IndexDescriptor_Direction) EnumDescriptor() ([]byte, []int)
func (IndexDescriptor_Direction) String ¶
func (x IndexDescriptor_Direction) String() string
func (IndexDescriptor_Direction) ToEncodingDirection ¶
func (dir IndexDescriptor_Direction) ToEncodingDirection() (encoding.Direction, error)
ToEncodingDirection converts a direction from the proto to an encoding.Direction.
func (*IndexDescriptor_Direction) UnmarshalJSON ¶
func (x *IndexDescriptor_Direction) UnmarshalJSON(data []byte) error
type IndexEntry ¶
IndexEntry represents an encoded key/value for an index entry.
func EncodeSecondaryIndex ¶
func EncodeSecondaryIndex( tableID ID, secondaryIndex *IndexDescriptor, colMap map[ColumnID]int, values []parser.Datum, ) (IndexEntry, error)
EncodeSecondaryIndex encodes key/values for a secondary index. colMap maps ColumnIDs to indices in `values`.
type IndexID ¶
type IndexID uint32
IndexID is a custom type for IndexDescriptor IDs.
func DecodeIndexKeyPrefix ¶
func DecodeIndexKeyPrefix(desc *TableDescriptor, key []byte) ( IndexID, []byte, error, )
DecodeIndexKeyPrefix decodes the prefix of an index key and returns the index id and a slice for the rest of the key.
type MetadataSchema ¶
type MetadataSchema struct {
// contains filtered or unexported fields
}
MetadataSchema is used to construct the initial sql schema for a new CockroachDB cluster being bootstrapped. Tables and databases must be installed on the underlying persistent storage before a cockroach store can start running correctly, thus requiring this special initialization.
func MakeMetadataSchema ¶
func MakeMetadataSchema() MetadataSchema
MakeMetadataSchema constructs a new MetadataSchema value which constructs the "system" database.
func (*MetadataSchema) AddDescriptor ¶
func (ms *MetadataSchema) AddDescriptor(parentID ID, desc DescriptorProto)
AddDescriptor adds a new descriptor to the system schema. Used only for SystemConfig tables and databases. Prefer AddTable for most uses.
func (*MetadataSchema) AddTable ¶
func (ms *MetadataSchema) AddTable(id ID, definition string, privileges privilege.List)
AddTable adds a new table to the system database.
func (MetadataSchema) DescriptorCount ¶
func (ms MetadataSchema) DescriptorCount() int
DescriptorCount returns the number of descriptors that will be created by this schema. This value is needed to automate certain tests.
func (MetadataSchema) GetInitialValues ¶
func (ms MetadataSchema) GetInitialValues() []roachpb.KeyValue
GetInitialValues returns the set of initial K/V values which should be added to a bootstrapping CockroachDB cluster in order to create the tables contained in the schema.
func (MetadataSchema) MaxTableID ¶
func (ms MetadataSchema) MaxTableID() ID
MaxTableID returns the highest table ID of any system table. This value is needed to automate certain tests.
func (MetadataSchema) TableCount ¶
func (ms MetadataSchema) TableCount() int
TableCount returns the number of non-system config tables in the system database. This value is needed to automate certain tests.
type MutationID ¶
type MutationID uint32
MutationID is custom type for TableDescriptor mutations.
const InvalidMutationID MutationID = 0
InvalidMutationID is the uninitialised mutation id.
type PrivilegeDescriptor ¶
type PrivilegeDescriptor struct {
Users []UserPrivileges `protobuf:"bytes,1,rep,name=users" json:"users"`
}
PrivilegeDescriptor describes a list of users and attached privileges. The list should be sorted by user for fast access.
func NewDefaultPrivilegeDescriptor ¶
func NewDefaultPrivilegeDescriptor() *PrivilegeDescriptor
NewDefaultPrivilegeDescriptor returns a privilege descriptor with ALL privileges for the root user.
func NewPrivilegeDescriptor ¶
func NewPrivilegeDescriptor(user string, priv privilege.List) *PrivilegeDescriptor
NewPrivilegeDescriptor returns a privilege descriptor for the given user with the specified list of privileges.
func (PrivilegeDescriptor) CheckPrivilege ¶
func (p PrivilegeDescriptor) CheckPrivilege(user string, priv privilege.Kind) bool
CheckPrivilege returns true if 'user' has 'privilege' on this descriptor.
func (*PrivilegeDescriptor) Descriptor ¶
func (*PrivilegeDescriptor) Descriptor() ([]byte, []int)
func (*PrivilegeDescriptor) Grant ¶
func (p *PrivilegeDescriptor) Grant(user string, privList privilege.List)
Grant adds new privileges to this descriptor for a given list of users. TODO(marc): if all privileges other than ALL are set, should we collapse them into ALL?
func (*PrivilegeDescriptor) Marshal ¶
func (m *PrivilegeDescriptor) Marshal() (data []byte, err error)
func (*PrivilegeDescriptor) MarshalTo ¶
func (m *PrivilegeDescriptor) MarshalTo(data []byte) (int, error)
func (*PrivilegeDescriptor) ProtoMessage ¶
func (*PrivilegeDescriptor) ProtoMessage()
func (*PrivilegeDescriptor) Reset ¶
func (m *PrivilegeDescriptor) Reset()
func (*PrivilegeDescriptor) Revoke ¶
func (p *PrivilegeDescriptor) Revoke(user string, privList privilege.List)
Revoke removes privileges from this descriptor for a given list of users.
func (PrivilegeDescriptor) Show ¶
func (p PrivilegeDescriptor) Show() []UserPrivilegeString
Show returns the list of {username, privileges} sorted by username. 'privileges' is a string of comma-separated sorted privilege names.
func (*PrivilegeDescriptor) Size ¶
func (m *PrivilegeDescriptor) Size() (n int)
func (*PrivilegeDescriptor) String ¶
func (m *PrivilegeDescriptor) String() string
func (*PrivilegeDescriptor) Unmarshal ¶
func (m *PrivilegeDescriptor) Unmarshal(data []byte) error
func (PrivilegeDescriptor) Validate ¶
func (p PrivilegeDescriptor) Validate(id ID) error
Validate is called when writing a database or table descriptor. It takes the descriptor ID which is used to determine if it belongs to a system descriptor, in which case the maximum set of allowed privileges is looked up and applied.
type RowFetcher ¶
type RowFetcher struct {
// contains filtered or unexported fields
}
RowFetcher handles fetching kvs and forming table rows. Usage:
var rf RowFetcher err := rf.Init(..) // Handle err err := rf.StartScan(..) // Handle err for { row, err := rf.NextRow() // Handle err if row == nil { // Done break } // Process row }
func (*RowFetcher) Init ¶
func (rf *RowFetcher) Init( desc *TableDescriptor, colIdxMap map[ColumnID]int, index *IndexDescriptor, reverse, isSecondaryIndex bool, cols []ColumnDescriptor, valNeededForCol []bool, ) error
Init sets up a RowFetcher for a given table and index. If we are using a non-primary index, valNeededForCol can only be true for the columns in the index.
func (*RowFetcher) Key ¶
func (rf *RowFetcher) Key() roachpb.Key
Key returns the next key (the key that follows the last returned row).
func (*RowFetcher) NextKey ¶
func (rf *RowFetcher) NextKey() (rowDone bool, err error)
NextKey retrieves the next key/value and sets kv/kvEnd. Returns whether a row has been completed. TODO(andrei): change to return error
func (*RowFetcher) NextKeyDebug ¶
func (rf *RowFetcher) NextKeyDebug() ( prettyKey string, prettyValue string, row parser.DTuple, err error, )
NextKeyDebug processes one key at a time and returns a pretty printed key and value. If we completed a row, the row is returned as well (see nextRow). If there are no more keys, prettyKey is "".
func (*RowFetcher) NextRow ¶
func (rf *RowFetcher) NextRow() (parser.DTuple, error)
NextRow processes keys until we complete one row, which is returned as a DTuple. The row contains one value per table column, regardless of the index used; values that are not needed (as per valNeededForCol) are nil.
The DTuple should not be modified and is only valid until the next call. When there are no more rows, the DTuple is nil.
func (*RowFetcher) ProcessKV ¶
func (rf *RowFetcher) ProcessKV(kv client.KeyValue, debugStrings bool) ( prettyKey string, prettyValue string, err error, )
ProcessKV processes the given key/value, setting values in the row accordingly. If debugStrings is true, returns pretty printed key and value information in prettyKey/prettyValue (otherwise they are empty strings).
func (*RowFetcher) ReadIndexKey ¶
func (rf *RowFetcher) ReadIndexKey(k roachpb.Key) (remaining []byte, err error)
ReadIndexKey decodes an index key for the fetcher's table.
type Span ¶
type Span struct { Start roachpb.Key // inclusive key End roachpb.Key // exclusive key Count int64 // max # of keys for this span }
Span represents a span that is part of a scan.
type SrcCtx ¶
SrcCtx contains contextual information about the source of an error.
func MakeSrcCtx ¶
MakeSrcCtx creates a SrcCtx value with contextual information about the caller at the requested depth.
type TableAndIndexID ¶
type TableAndIndexID struct { Table ID `protobuf:"varint,1,opt,name=table,casttype=ID" json:"table"` Index IndexID `protobuf:"varint,2,opt,name=index,casttype=IndexID" json:"index"` }
func (*TableAndIndexID) Descriptor ¶
func (*TableAndIndexID) Descriptor() ([]byte, []int)
func (TableAndIndexID) IndexKeyPrefix ¶
func (t TableAndIndexID) IndexKeyPrefix() []byte
IndexKeyPrefix returns the prefix for the table-index reference.
func (*TableAndIndexID) Marshal ¶
func (m *TableAndIndexID) Marshal() (data []byte, err error)
func (*TableAndIndexID) ProtoMessage ¶
func (*TableAndIndexID) ProtoMessage()
func (*TableAndIndexID) Reset ¶
func (m *TableAndIndexID) Reset()
func (*TableAndIndexID) Size ¶
func (m *TableAndIndexID) Size() (n int)
func (*TableAndIndexID) String ¶
func (m *TableAndIndexID) String() string
func (*TableAndIndexID) Unmarshal ¶
func (m *TableAndIndexID) Unmarshal(data []byte) error
type TableDescriptor ¶
type TableDescriptor struct { // The table name. It should be normalized using sqlbase.NormalizeName() // before comparing it. Name string `protobuf:"bytes,1,opt,name=name" json:"name"` ID ID `protobuf:"varint,3,opt,name=id,casttype=ID" json:"id"` // ID of the parent database. ParentID ID `protobuf:"varint,4,opt,name=parent_id,json=parentId,casttype=ID" json:"parent_id"` // Monotonically increasing version of the table descriptor. // // Invariants: // 1. not more than two subsequent versions of the table // descriptor can be leased. This is to make the system // easy to reason about, by permiting mutation state // changes (reflected in the next version), only when the existing // state (reflected in the current version) is present on all // outstanding unexpired leases. // 2. A schema change command (ALTER, RENAME, etc) never directly // increments the version. This allows the command to execute without // waiting for the entire cluster to converge to a single version // preventing weird deadlock situations. For instance, a transaction // with a schema change command might use a descriptor lease that is // at version: v - 1, and therefore deadlock when it tries to wait // for version: v, in the process of incrementing it to v + 1. // Therefore, a schema change command never increments the version, // and instead, sets the up_version boolean to notify the schema // changer execution engine that runs a future transaction to // increment the version. // // The schema change commands must therefore make *safe* modifications // to the table descriptor, such as scheduling long running schema // changes through mutations for future execution, or making simple // schema changes like RENAME that only modify the table descriptor in a // single transaction. // // Multiple schema changes in the same transaction set up_version. // The actual schema change execution that follows a schema change // command sees the up_version boolean set, and increments the // table version after ensuring that there are no unexpired leases // for version - 1. The schema change execution must increment // the version before executing future state changes, to ensure // that the scheduled mutations made by the original commands are // visible on all leases. Multiple schema change mutations can be // grouped together on a particular version increment. // // If schema change commands are safe to run without incrementing // the version, why do it later on? We increment the version // to ensure that all the nodes renew their leases with the new version // and get to see what the schema change command has done quickly. Version DescriptorVersion `protobuf:"varint,5,opt,name=version,casttype=DescriptorVersion" json:"version"` // See comment above. UpVersion bool `protobuf:"varint,6,opt,name=up_version,json=upVersion" json:"up_version"` // Last modification time of the table descriptor. ModificationTime cockroach_util_hlc.Timestamp `protobuf:"bytes,7,opt,name=modification_time,json=modificationTime" json:"modification_time"` Columns []ColumnDescriptor `protobuf:"bytes,8,rep,name=columns" json:"columns"` // next_column_id is used to ensure that deleted column ids are not reused. NextColumnID ColumnID `protobuf:"varint,9,opt,name=next_column_id,json=nextColumnId,casttype=ColumnID" json:"next_column_id"` Families []ColumnFamilyDescriptor `protobuf:"bytes,22,rep,name=families" json:"families"` // next_family_id is used to ensure that deleted family ids are not reused. NextFamilyID FamilyID `protobuf:"varint,23,opt,name=next_family_id,json=nextFamilyId,casttype=FamilyID" json:"next_family_id"` PrimaryIndex IndexDescriptor `protobuf:"bytes,10,opt,name=primary_index,json=primaryIndex" json:"primary_index"` // indexes are all the secondary indexes. Indexes []IndexDescriptor `protobuf:"bytes,11,rep,name=indexes" json:"indexes"` // next_index_id is used to ensure that deleted index ids are not reused. NextIndexID IndexID `protobuf:"varint,12,opt,name=next_index_id,json=nextIndexId,casttype=IndexID" json:"next_index_id"` Privileges *PrivilegeDescriptor `protobuf:"bytes,13,opt,name=privileges" json:"privileges,omitempty"` // Columns or indexes being added or deleted in a FIFO order. Mutations []DescriptorMutation `protobuf:"bytes,14,rep,name=mutations" json:"mutations"` Lease *TableDescriptor_SchemaChangeLease `protobuf:"bytes,15,opt,name=lease" json:"lease,omitempty"` // An id for the next group of mutations to be applied together. NextMutationID MutationID `protobuf:"varint,16,opt,name=next_mutation_id,json=nextMutationId,casttype=MutationID" json:"next_mutation_id"` // format_version declares which sql to key:value mapping is being used to // represent the data in this table. FormatVersion FormatVersion `protobuf:"varint,17,opt,name=format_version,json=formatVersion,casttype=FormatVersion" json:"format_version"` State TableDescriptor_State `protobuf:"varint,19,opt,name=state,enum=cockroach.sql.sqlbase.TableDescriptor_State" json:"state"` Checks []*TableDescriptor_CheckConstraint `protobuf:"bytes,20,rep,name=checks" json:"checks,omitempty"` // This array is populated if the descriptor was renamed. If the descriptor is // renamed multiple times before the schema chage is processed, there will be // one element for each rename. // When this is detected in a schema change, the records for the old names are // deleted and this field is cleared. Renames []TableDescriptor_RenameInfo `protobuf:"bytes,21,rep,name=renames" json:"renames"` }
A TableDescriptor represents a table and is stored in a structured metadata key. The TableDescriptor has a globally-unique ID, while its member {Column,Index}Descriptors have locally-unique IDs.
func GetTableDescriptor ¶
func GetTableDescriptor(kvDB *client.DB, database string, table string) *TableDescriptor
GetTableDescriptor retrieves a table descriptor directly from the KV layer.
func MakeTableDesc ¶
func MakeTableDesc(p *parser.CreateTable, parentID ID) (TableDescriptor, error)
MakeTableDesc creates a table descriptor from a CreateTable statement.
func (*TableDescriptor) AddColumn ¶
func (desc *TableDescriptor) AddColumn(col ColumnDescriptor)
AddColumn adds a column to the table.
func (*TableDescriptor) AddColumnMutation ¶
func (desc *TableDescriptor) AddColumnMutation(c ColumnDescriptor, direction DescriptorMutation_Direction)
AddColumnMutation adds a column mutation to desc.Mutations.
func (*TableDescriptor) AddFamily ¶
func (desc *TableDescriptor) AddFamily(fam ColumnFamilyDescriptor)
AddFamily adds a family to the table.
func (*TableDescriptor) AddIndex ¶
func (desc *TableDescriptor) AddIndex(idx IndexDescriptor, primary bool) error
AddIndex adds an index to the table.
func (*TableDescriptor) AddIndexMutation ¶
func (desc *TableDescriptor) AddIndexMutation(idx IndexDescriptor, direction DescriptorMutation_Direction)
AddIndexMutation adds an index mutation to desc.Mutations.
func (*TableDescriptor) AllNonDropIndexes ¶
func (desc *TableDescriptor) AllNonDropIndexes() []IndexDescriptor
AllNonDropIndexes returns all the indexes, including those being added in the mutations.
func (*TableDescriptor) AllocateIDs ¶
func (desc *TableDescriptor) AllocateIDs() error
AllocateIDs allocates column, family, and index ids for any column, family, or index which has an ID of 0.
func (*TableDescriptor) Deleted ¶
func (desc *TableDescriptor) Deleted() bool
Deleted returns true if the table is being deleted.
func (*TableDescriptor) Descriptor ¶
func (*TableDescriptor) Descriptor() ([]byte, []int)
func (*TableDescriptor) FinalizeMutation ¶
func (desc *TableDescriptor) FinalizeMutation() (MutationID, error)
FinalizeMutation returns the id that has been used by mutations appended with addMutation() since the last time this function was called. Future mutations will use a new ID.
func (*TableDescriptor) FindActiveColumnByID ¶
func (desc *TableDescriptor) FindActiveColumnByID(id ColumnID) (*ColumnDescriptor, error)
FindActiveColumnByID finds the active column with specified ID.
func (*TableDescriptor) FindActiveColumnByName ¶
func (desc *TableDescriptor) FindActiveColumnByName(name string) (ColumnDescriptor, error)
FindActiveColumnByName finds an active column with the specified name.
func (*TableDescriptor) FindColumnByID ¶
func (desc *TableDescriptor) FindColumnByID(id ColumnID) (*ColumnDescriptor, error)
FindColumnByID finds the column with specified ID.
func (*TableDescriptor) FindColumnByName ¶
func (desc *TableDescriptor) FindColumnByName(name string) (DescriptorStatus, int, error)
FindColumnByName finds the column with the specified name. It returns DescriptorStatus for the column, and an index into either the columns (status == DescriptorActive) or mutations (status == DescriptorIncomplete).
func (*TableDescriptor) FindFamilyByID ¶
func (desc *TableDescriptor) FindFamilyByID(id FamilyID) (*ColumnFamilyDescriptor, error)
FindFamilyByID finds the family with specified ID.
func (*TableDescriptor) FindIndexByID ¶
func (desc *TableDescriptor) FindIndexByID(id IndexID) (*IndexDescriptor, error)
FindIndexByID finds an index (active or inactive) with the specified ID. Must return a pointer to the IndexDescriptor in the TableDescriptor, so that callers can use returned values to modify the TableDesc.
func (*TableDescriptor) FindIndexByName ¶
func (desc *TableDescriptor) FindIndexByName(name string) (DescriptorStatus, int, error)
FindIndexByName finds the index with the specified name. It returns DescriptorStatus for the index, and an index into either the indexes (status == DescriptorActive) or mutations (status == DescriptorIncomplete).
func (*TableDescriptor) GetChecks ¶
func (m *TableDescriptor) GetChecks() []*TableDescriptor_CheckConstraint
func (*TableDescriptor) GetColumns ¶
func (m *TableDescriptor) GetColumns() []ColumnDescriptor
func (*TableDescriptor) GetFamilies ¶
func (m *TableDescriptor) GetFamilies() []ColumnFamilyDescriptor
func (*TableDescriptor) GetFormatVersion ¶
func (m *TableDescriptor) GetFormatVersion() FormatVersion
func (*TableDescriptor) GetID ¶
func (m *TableDescriptor) GetID() ID
func (*TableDescriptor) GetIndexes ¶
func (m *TableDescriptor) GetIndexes() []IndexDescriptor
func (*TableDescriptor) GetLease ¶
func (m *TableDescriptor) GetLease() *TableDescriptor_SchemaChangeLease
func (*TableDescriptor) GetModificationTime ¶
func (m *TableDescriptor) GetModificationTime() cockroach_util_hlc.Timestamp
func (*TableDescriptor) GetMutations ¶
func (m *TableDescriptor) GetMutations() []DescriptorMutation
func (*TableDescriptor) GetName ¶
func (m *TableDescriptor) GetName() string
func (*TableDescriptor) GetNextColumnID ¶
func (m *TableDescriptor) GetNextColumnID() ColumnID
func (*TableDescriptor) GetNextFamilyID ¶
func (m *TableDescriptor) GetNextFamilyID() FamilyID
func (*TableDescriptor) GetNextIndexID ¶
func (m *TableDescriptor) GetNextIndexID() IndexID
func (*TableDescriptor) GetNextMutationID ¶
func (m *TableDescriptor) GetNextMutationID() MutationID
func (*TableDescriptor) GetParentID ¶
func (m *TableDescriptor) GetParentID() ID
func (*TableDescriptor) GetPrimaryIndex ¶
func (m *TableDescriptor) GetPrimaryIndex() IndexDescriptor
func (*TableDescriptor) GetPrivileges ¶
func (m *TableDescriptor) GetPrivileges() *PrivilegeDescriptor
func (*TableDescriptor) GetRenames ¶
func (m *TableDescriptor) GetRenames() []TableDescriptor_RenameInfo
func (*TableDescriptor) GetState ¶
func (m *TableDescriptor) GetState() TableDescriptor_State
func (*TableDescriptor) GetUpVersion ¶
func (m *TableDescriptor) GetUpVersion() bool
func (*TableDescriptor) GetVersion ¶
func (m *TableDescriptor) GetVersion() DescriptorVersion
func (*TableDescriptor) IsEmpty ¶
func (desc *TableDescriptor) IsEmpty() bool
IsEmpty checks if the descriptor is uninitialized.
func (*TableDescriptor) MakeMutationComplete ¶
func (desc *TableDescriptor) MakeMutationComplete(m DescriptorMutation)
MakeMutationComplete updates the descriptor upon completion of a mutation.
func (*TableDescriptor) Marshal ¶
func (m *TableDescriptor) Marshal() (data []byte, err error)
func (*TableDescriptor) MaybeUpgradeFormatVersion ¶
func (desc *TableDescriptor) MaybeUpgradeFormatVersion() bool
MaybeUpgradeFormatVersion transforms the TableDescriptor to the latest FormatVersion (if it's not already there) and returns true if any changes were made.
func (*TableDescriptor) ProtoMessage ¶
func (*TableDescriptor) ProtoMessage()
func (*TableDescriptor) RemoveColumnFromFamily ¶
func (desc *TableDescriptor) RemoveColumnFromFamily(colID ColumnID)
RemoveColumnFromFamily removes a colID from the family it's assigned to.
func (*TableDescriptor) RenameColumn ¶
func (desc *TableDescriptor) RenameColumn(colID ColumnID, newColName string)
RenameColumn updates all references to a column name in indexes and families.
func (*TableDescriptor) Renamed ¶
func (desc *TableDescriptor) Renamed() bool
Renamed returns true if the table is being renamed.
func (*TableDescriptor) Reset ¶
func (m *TableDescriptor) Reset()
func (*TableDescriptor) SetID ¶
func (desc *TableDescriptor) SetID(id ID)
SetID implements the DescriptorProto interface.
func (*TableDescriptor) SetName ¶
func (desc *TableDescriptor) SetName(name string)
SetName implements the DescriptorProto interface.
func (*TableDescriptor) SetUpVersion ¶
func (desc *TableDescriptor) SetUpVersion() error
SetUpVersion sets the up_version marker on the table descriptor (see the proto
func (*TableDescriptor) Size ¶
func (m *TableDescriptor) Size() (n int)
func (*TableDescriptor) String ¶
func (m *TableDescriptor) String() string
func (*TableDescriptor) TypeName ¶
func (desc *TableDescriptor) TypeName() string
TypeName returns the plain type of this descriptor.
func (*TableDescriptor) Unmarshal ¶
func (m *TableDescriptor) Unmarshal(data []byte) error
func (*TableDescriptor) Validate ¶
func (desc *TableDescriptor) Validate() error
Validate validates that the table descriptor is well formed. Checks include validating the table, column and index names, verifying that column names and index names are unique and verifying that column IDs and index IDs are consistent.
func (*TableDescriptor) VisibleColumns ¶
func (desc *TableDescriptor) VisibleColumns() []ColumnDescriptor
VisibleColumns returns all non hidden columns.
type TableDescriptor_CheckConstraint ¶
type TableDescriptor_CheckConstraint struct { Expr string `protobuf:"bytes,1,opt,name=expr" json:"expr"` Name string `protobuf:"bytes,2,opt,name=name" json:"name"` }
func (*TableDescriptor_CheckConstraint) Descriptor ¶
func (*TableDescriptor_CheckConstraint) Descriptor() ([]byte, []int)
func (*TableDescriptor_CheckConstraint) Marshal ¶
func (m *TableDescriptor_CheckConstraint) Marshal() (data []byte, err error)
func (*TableDescriptor_CheckConstraint) MarshalTo ¶
func (m *TableDescriptor_CheckConstraint) MarshalTo(data []byte) (int, error)
func (*TableDescriptor_CheckConstraint) ProtoMessage ¶
func (*TableDescriptor_CheckConstraint) ProtoMessage()
func (*TableDescriptor_CheckConstraint) Reset ¶
func (m *TableDescriptor_CheckConstraint) Reset()
func (*TableDescriptor_CheckConstraint) Size ¶
func (m *TableDescriptor_CheckConstraint) Size() (n int)
func (*TableDescriptor_CheckConstraint) String ¶
func (m *TableDescriptor_CheckConstraint) String() string
func (*TableDescriptor_CheckConstraint) Unmarshal ¶
func (m *TableDescriptor_CheckConstraint) Unmarshal(data []byte) error
type TableDescriptor_RenameInfo ¶
type TableDescriptor_RenameInfo struct { // The database that the table belonged to before the rename (tables can be // renamed from one db to another). OldParentID uint32 `protobuf:"varint,1,opt,name=old_parent_id,json=oldParentId" json:"old_parent_id"` OldName string `protobuf:"bytes,2,opt,name=old_name,json=oldName" json:"old_name"` }
func (*TableDescriptor_RenameInfo) Descriptor ¶
func (*TableDescriptor_RenameInfo) Descriptor() ([]byte, []int)
func (*TableDescriptor_RenameInfo) Marshal ¶
func (m *TableDescriptor_RenameInfo) Marshal() (data []byte, err error)
func (*TableDescriptor_RenameInfo) MarshalTo ¶
func (m *TableDescriptor_RenameInfo) MarshalTo(data []byte) (int, error)
func (*TableDescriptor_RenameInfo) ProtoMessage ¶
func (*TableDescriptor_RenameInfo) ProtoMessage()
func (*TableDescriptor_RenameInfo) Reset ¶
func (m *TableDescriptor_RenameInfo) Reset()
func (*TableDescriptor_RenameInfo) Size ¶
func (m *TableDescriptor_RenameInfo) Size() (n int)
func (*TableDescriptor_RenameInfo) String ¶
func (m *TableDescriptor_RenameInfo) String() string
func (*TableDescriptor_RenameInfo) Unmarshal ¶
func (m *TableDescriptor_RenameInfo) Unmarshal(data []byte) error
type TableDescriptor_SchemaChangeLease ¶
type TableDescriptor_SchemaChangeLease struct { NodeID github_com_cockroachdb_cockroach_roachpb.NodeID `protobuf:"varint,1,opt,name=node_id,json=nodeId,casttype=github.com/cockroachdb/cockroach/roachpb.NodeID" json:"node_id"` // Nanoseconds since the Unix epoch. ExpirationTime int64 `protobuf:"varint,2,opt,name=expiration_time,json=expirationTime" json:"expiration_time"` }
The schema update lease. A single goroutine across a cockroach cluster can own it, and will execute pending schema changes for this table. Since the execution of a pending schema change is through transactions, it is legal for more than one goroutine to attempt to execute it. This lease reduces write contention on the schema change.
func (*TableDescriptor_SchemaChangeLease) Descriptor ¶
func (*TableDescriptor_SchemaChangeLease) Descriptor() ([]byte, []int)
func (*TableDescriptor_SchemaChangeLease) Marshal ¶
func (m *TableDescriptor_SchemaChangeLease) Marshal() (data []byte, err error)
func (*TableDescriptor_SchemaChangeLease) MarshalTo ¶
func (m *TableDescriptor_SchemaChangeLease) MarshalTo(data []byte) (int, error)
func (*TableDescriptor_SchemaChangeLease) ProtoMessage ¶
func (*TableDescriptor_SchemaChangeLease) ProtoMessage()
func (*TableDescriptor_SchemaChangeLease) Reset ¶
func (m *TableDescriptor_SchemaChangeLease) Reset()
func (*TableDescriptor_SchemaChangeLease) Size ¶
func (m *TableDescriptor_SchemaChangeLease) Size() (n int)
func (*TableDescriptor_SchemaChangeLease) String ¶
func (m *TableDescriptor_SchemaChangeLease) String() string
func (*TableDescriptor_SchemaChangeLease) Unmarshal ¶
func (m *TableDescriptor_SchemaChangeLease) Unmarshal(data []byte) error
type TableDescriptor_State ¶
type TableDescriptor_State int32
State is set if this TableDescriptor is in the process of being added or deleted. A non-public table descriptor cannot be leased. A schema changer observing DROP set will truncate the table and delete the descriptor. It is illegal to transition DROP to any other state.
const ( // Not used. TableDescriptor_PUBLIC TableDescriptor_State = 0 // Descriptor is being added. TableDescriptor_ADD TableDescriptor_State = 1 // Descriptor is being dropped. TableDescriptor_DROP TableDescriptor_State = 2 )
func (TableDescriptor_State) Enum ¶
func (x TableDescriptor_State) Enum() *TableDescriptor_State
func (TableDescriptor_State) EnumDescriptor ¶
func (TableDescriptor_State) EnumDescriptor() ([]byte, []int)
func (TableDescriptor_State) String ¶
func (x TableDescriptor_State) String() string
func (*TableDescriptor_State) UnmarshalJSON ¶
func (x *TableDescriptor_State) UnmarshalJSON(data []byte) error
type UserPrivilegeString ¶
UserPrivilegeString is a pair of strings describing the privileges for a given user.
type UserPrivileges ¶
type UserPrivileges struct { User string `protobuf:"bytes,1,opt,name=user" json:"user"` // privileges is a bitfield of 1<<Privilege values. Privileges uint32 `protobuf:"varint,2,opt,name=privileges" json:"privileges"` }
UserPrivileges describes the list of privileges available for a given user.
func (*UserPrivileges) Descriptor ¶
func (*UserPrivileges) Descriptor() ([]byte, []int)
func (*UserPrivileges) Marshal ¶
func (m *UserPrivileges) Marshal() (data []byte, err error)
func (*UserPrivileges) ProtoMessage ¶
func (*UserPrivileges) ProtoMessage()
func (*UserPrivileges) Reset ¶
func (m *UserPrivileges) Reset()
func (*UserPrivileges) Size ¶
func (m *UserPrivileges) Size() (n int)
func (*UserPrivileges) String ¶
func (m *UserPrivileges) String() string
func (*UserPrivileges) Unmarshal ¶
func (m *UserPrivileges) Unmarshal(data []byte) error