types

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const InvalidPageID = PageID(-1)

InvalidPageID represents an invalid page ID

View Source
const SizeOfLSN = 4

Variables

This section is empty.

Functions

This section is empty.

Types

type LSN

type LSN int32

LSN is the type of the log identifier

func NewLSNFromBytes

func NewLSNFromBytes(data []byte) (ret LSN)

NewLSNFromBytes creates a LSN from []byte

func (LSN) AtomicAdd

func (lsn LSN) AtomicAdd(val int32)

func (LSN) Serialize

func (lsn LSN) Serialize() []byte

Serialize casts it to []byte

type PageID

type PageID int32

PageID is the type of the page identifier

func NewPageIDFromBytes

func NewPageIDFromBytes(data []byte) (ret PageID)

NewPageIDFromBytes creates a page id from []byte

func (PageID) IsValid

func (id PageID) IsValid() bool

IsValid checks if id is valid

func (PageID) Serialize

func (id PageID) Serialize() []byte

Serialize casts it to []byte

type TxnID

type TxnID int32

TxnID is the type of the transaction identifier

func NewTxnIDFromBytes

func NewTxnIDFromBytes(data []byte) (ret TxnID)

NewPageIDFromBytes creates a page id from []byte

func (*TxnID) AtomicAdd

func (id *TxnID) AtomicAdd(val int32)

func (TxnID) Serialize

func (id TxnID) Serialize() []byte

Serialize casts it to []byte

type TypeID

type TypeID int
const (
	Invalid TypeID = iota
	Boolean
	Tinyint
	Smallint
	Integer
	BigInt
	Decimal
	Float
	Varchar
	Timestamp
	Null
)

Every possible SQL type ID

func (TypeID) Size

func (t TypeID) Size() uint32

type UInt32

type UInt32 uint32

func NewUInt32FromBytes

func NewUInt32FromBytes(data []byte) (ret UInt32)

NewUInt32FromBytes creates a page id from []byte

func (UInt32) Serialize

func (id UInt32) Serialize() []byte

Serialize casts it to []byte

type Value

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

A value is an class that represents a view over SQL data stored in some materialized state. All values have a type and comparison functions, and implement other type-specific functionality.

func NewBoolean

func NewBoolean(value bool) Value

func NewFloat

func NewFloat(value float32) Value

func NewInteger

func NewInteger(value int32) Value

func NewNull

func NewNull() Value

it can be used only when you can not know value type to be compared or something

func NewValueFromBytes

func NewValueFromBytes(data []byte, valueType TypeID) (ret *Value)

NewValueFromBytes is used for deserialization

func NewVarchar

func NewVarchar(value string) Value

func (Value) Add

func (v Value) Add(other *Value) *Value

func (Value) CompareEquals

func (v Value) CompareEquals(right Value) bool

func (Value) CompareGreaterThan

func (v Value) CompareGreaterThan(right Value) bool

func (Value) CompareGreaterThanOrEqual

func (v Value) CompareGreaterThanOrEqual(right Value) bool

func (Value) CompareLessThan

func (v Value) CompareLessThan(right Value) bool

func (Value) CompareLessThanOrEqual

func (v Value) CompareLessThanOrEqual(right Value) bool

func (Value) CompareNotEquals

func (v Value) CompareNotEquals(right Value) bool

func (Value) IsNull

func (v Value) IsNull() bool

func (Value) Max

func (v Value) Max(other *Value) *Value

func (Value) Min

func (v Value) Min(other *Value) *Value

func (Value) Serialize

func (v Value) Serialize() []byte

func (Value) SetNull

func (v Value) SetNull() *Value

note: (need to be) only way to get Value object which has NULL value

a value filed correspoding to value type is initialized to default value

func (Value) Size

func (v Value) Size() uint32

Size returns the size in bytes that the type will occupy inside the tuple

func (Value) ToBoolean

func (v Value) ToBoolean() bool

if you use this to get column value NULL value check is needed in general

func (Value) ToFloat

func (v Value) ToFloat() float32

if you use this to get column value NULL value check is needed in general

func (Value) ToInteger

func (v Value) ToInteger() int32

if you use this to get column value NULL value check is needed in general

func (Value) ToString

func (v Value) ToString() string

func (Value) ToVarchar

func (v Value) ToVarchar() string

if you use this to get column value NULL value check is needed in general

func (Value) ValueType

func (v Value) ValueType() TypeID

Jump to

Keyboard shortcuts

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