rapidash

package module
Version: v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 23 Imported by: 0

README

Rapidash GoDoc CircleCI codecov README_JP

2

Rapidash is a Go package for the database record or other data caching.
It not only supports memcached or Redis for generic caching (e.g. get/set ) but also supports fast access to read-only data by fetching all read-only records from the database and caching them to memory on application.
Also, It supports Read-Through / Write-Through caching for read/write records on the database.

Main features are the following.

1. Features

  • Fetches all read-only records from database at application startup and according to the index definition it expand as B+Tree structure on the memory. To get caching data, can use Query Builder and it available range searching.
  • Caching read/write table records to memcached or Redis for searching records fastly or load balancing database.
  • Supports generic caching (e.g. get/set ) for memcached or Redis
  • Supports transaction for caching
  • Supports select caching server by cache-key pattern from multiple cache servers
  • Supports Consistent Hashing for distributed caching
  • Fast encoding/decoding without reflect package
  • Compress caching data by msgpack

Also, Rapidash has beautiful access log visualizer. It visualize query and value between stash ( on the application ) and caching server and database like the following.

Visualize by HTML
スクリーンショット 2019-08-15 22 40 15
Visualize by Console
スクリーンショット 2019-08-15 22 47 09

Rapidash has three components.
First, we call component for caching the read-only records FirstLevelCache.
Second, we call component for caching the read/write records SecondLevelCache.
Finaly, we call component for generic caching LastLevelCache.

2. Benchmarks

2.1. FirstLevelCache Benchmarks

2.1.1. SELECT

By Primary Key

database/sql   200           9596890 ns/op          180199 B/op       4594 allocs/op
rapidash     50000             43565 ns/op           10734 B/op        100 allocs/op

x250 faster than database/sql

By Multiple Primary Keys ( IN query )

database/sql   100          13149288 ns/op          423101 B/op      13500 allocs/op
rapidash      5000            273461 ns/op          114952 B/op       2500 allocs/op

x50 faster than database/sql

2.2. SecondLevelCache Benchmarks

2.2.1. SELECT

Select by PRIMARY INDEX ( like SELECT * FROM table WHERE id = ? )

database/sql                   10000            127838 ns/op            1443 B/op         41 allocs/op
gorm                           10000            163271 ns/op           10122 B/op        201 allocs/op
rapidash worst ( all miss hit)  5000            234159 ns/op            9948 B/op        240 allocs/op
rapidash best ( all hit )      30000             46576 ns/op            5339 B/op        120 allocs/op

If cache is all hits, x3 faster than datbase/sql

2.2.2. INSERT
database/sql  3000            461925 ns/op            1235 B/op         25 allocs/op
gorm          3000            475054 ns/op            5831 B/op        118 allocs/op
rapidash      2000            602111 ns/op           13548 B/op        305 allocs/op
2.2.3. UPDATE
database/sql                    3000            502141 ns/op             676 B/op         17 allocs/op
gorm                            3000            553302 ns/op           11815 B/op        229 allocs/op
rapidash worst ( all miss hit ) 2000            775627 ns/op           12553 B/op        307 allocs/op
rapidash best ( all hit )       2000            594131 ns/op            8241 B/op        192 allocs/op
2.2.4. DELETE
database/sql  3000            485844 ns/op             579 B/op         17 allocs/op
gorm          3000            502079 ns/op            3789 B/op         80 allocs/op
rapidash      3000            543378 ns/op            3169 B/op         80 allocs/op

3. Install

3.1. Install as a Library

go get -u go.knocknote.io/rapidash

3.2 Install as a CLI tool

go get -u go.knocknote.io/rapidash/cmd/rapidash

4. Document

GoDoc

5. Usage

5.1 Fastly access to the read-only records

For example, if your application has immutable data-set by user actions like master data for gaming application, Rapidash fetch all them from database at application startup and according to the index definition they expand as B+Tree structure.

For example, we create events table on the database and insert some records to it.

CREATE TABLE events (
  id bigint(20) unsigned NOT NULL,
  event_id bigint(20) unsigned NOT NULL,
  term enum('early_morning', 'morning', 'daytime', 'evening', 'night', 'midnight') NOT NULL,
  start_week int(10) unsigned NOT NULL,
  end_week int(10) unsigned NOT NULL,
  created_at datetime NOT NULL,
  updated_at datetime NOT NULL,
  PRIMARY KEY (id),
  UNIQUE KEY (event_id, start_week)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

For caching records of events table, we could write the following.

package main

import (
	"database/sql"
	"time"

	_ "github.com/go-sql-driver/mysql"
	"go.knocknote.io/rapidash"
)

// Go structure for schema of `events`
type Event struct {
	ID        int64
	EventID   int64
	Term      string
	StartWeek uint8
	EndWeek   uint8
	CreatedAt time.Time
	UpdatedAt time.Time
}

// For decoding record
func (e *Event) DecodeRapidash(dec rapidash.Decoder) error {
	e.ID = dec.Int64("id")
	e.EventID = dec.Int64("event_id")
	e.Term = dec.String("term")
	e.StartWeek = dec.Uint8("start_week")
	e.EndWeek = dec.Uint8("end_week")
	e.CreatedAt = dec.Time("created_at")
	e.UpdatedAt = dec.Time("updated_at")
	return dec.Error()
}

// Map column of `events` table to Go type
func (e *Event) Struct() *rapidash.Struct {
	return rapidash.NewStruct("events").
		FieldInt64("id").
		FieldInt64("event_id").
		FieldString("term").
		FieldUint8("start_week").
		FieldUint8("end_week").
		FieldTime("created_at").
		FieldTime("updated_at")
}

func main() {
	conn, err := sql.Open("mysql", "root:@tcp(localhost:3306)/rapidash?parseTime=true")
	if err != nil {
		panic(err)
	}

	// Create `*rapidash.Rapidash` instance
	cache, err := rapidash.New()
	if err != nil {
		panic(err)
	}
	
	// Cache all records on the `events` table
	if err := cache.WarmUp(conn, new(Event).Struct(), true); err != nil {
		panic(err)
	}

	// Create `*rapidash.Tx` instance from `*rapidash.Rapidash`
	tx, err := cache.Begin()
	if err != nil {
		panic(err)
	}

	// SELECT * FROM events
	//   WHERE `event_id` = 1 AND
	//      `start_week` <= 3 AND
	//      `end_week` >= 3   AND
	//      `term` = daytime
	builder := rapidash.NewQueryBuilder("events").
		Eq("event_id", uint64(1)).
		Lte("start_week", uint8(3)).
		Gte("end_week", uint8(3)).
		Eq("term", "daytime")
	var event Event
	if err := tx.FindByQueryBuilder(builder, &event); err != nil {
		panic(err)
	}
}

5.2 Fastly access to the read/write records

CREATE TABLE IF NOT EXISTS user_logins (
  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  user_id bigint(20) unsigned NOT NULL,
  user_session_id bigint(20) unsigned NOT NULL,
  login_param_id bigint(20) unsigned NOT NULL,
  name varchar(255) NOT NULL,
  created_at datetime NOT NULL,
  updated_at datetime NOT NULL,
  PRIMARY KEY (id),
  UNIQUE KEY (user_id, user_session_id),
  KEY (user_id, login_param_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

For example, we create user_logins table on the database and insert some records to it. For caching records of user_logins table, we could write the following.

※ Previously, we start memcached with 11211 port.

package main

import (
	"database/sql"
	"time"

	_ "github.com/go-sql-driver/mysql"
	"go.knocknote.io/rapidash"
)

// Go structure for schema of `user_logins`
type UserLogin struct {
	ID            int64
	UserID        int64
	UserSessionID int64
	LoginParamID  int64
	Name          string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

// For encoding record
func (u *UserLogin) EncodeRapidash(enc Encoder) error {
	if u.ID != 0 {
		enc.Int64("id", u.ID)
	}
	enc.Int64("user_id", u.UserID)
	enc.Int64("user_session_id", u.UserSessionID)
	enc.Int64("login_param_id", u.LoginParamID)
	enc.String("name", u.Name)
	enc.Time("created_at", u.CreatedAt)
	enc.Time("updated_at", u.UpdatedAt)
	return enc.Error()
}

// For decoding record
func (u *UserLogin) DecodeRapidash(dec Decoder) error {
	u.ID = dec.Int64("id")
	u.UserID = dec.Int64("user_id")
	u.UserSessionID = dec.Int64("user_session_id")
	u.LoginParamID = dec.Int64("login_param_id")
	u.Name = dec.String("name")
	u.CreatedAt = dec.Time("created_at")
	u.UpdatedAt = dec.Time("updated_at")
	return dec.Error()
}

// Map column of `user_logins` table to Go type
func (u *UserLogin) Struct() *rapidash.Struct {
	return rapidash.NewStruct("user_logins").
		FieldInt64("id").
		FieldInt64("user_id").
		FieldInt64("user_session_id").
		FieldInt64("login_param_id").
		FieldString("name").
		FieldTime("created_at").
		FieldTime("updated_at")
}

func main() {
	conn, err := sql.Open("mysql", "root:@tcp(localhost:3306)/rapidash?parseTime=true")
	if err != nil {
		panic(err)
	}

	// Create `*rapidash.Rapidash` instance with ServerAddrs option
	cache, err := rapidash.New(rapidash.ServerAddrs([]string{"localhost:11211"}))
	if err != nil {
		panic(err)
	}
	if err := cache.WarmUp(conn, new(UserLogin).Struct(), false); err != nil {
		panic(err)
	}

	// Create `*sql.Tx` instance
	txConn, err := conn.Begin()
	if err != nil {
		panic(err)
	}
	// Create `*rapidash.Tx` instance from `*sql.Tx`
	tx, err := cache.Begin(txConn)
	if err != nil {
		panic(err)
	}

	// SELECT * FROM user_logins
	//   WHERE `user_id` = 1 AND `user_session_id` = 1
	builder := rapidash.NewQueryBuilder("user_logins").
		Eq("user_id", int64(1)).
		Eq("user_session_id", int64(1))

	// Search from memcached first, fetch it from database if without cache on memcached
	var userLogin UserLogin
	if err := tx.FindByQueryBuilder(builder, &userLogin); err != nil {
		panic(err)
	}

	// Set cache to memcached
	if err := tx.Commit(); err != nil {
		panic(err)
	}
}

5.3 Generic caching

5.3.1 Encode/Decode
Primitive Types

int , int8 , int16 , int32 , int64 , uint , uint8 , uint16 , uint32, uint64 , float32, float64 , []byte , string , bool

The above types can use API like rapidash.Int(1) and rapidash.IntPtr(v) ( ※ v is *int type ) for encoding and decoding .

Primitive Slice Types

[]int , []int8 , []int16 , []int32 , []int64 , []uint , []uint8 , []uint16 , []uint32, []uint64 , []float32, []float64 , [][]byte , []string , []bool

The above types can use API like rapidash.Ints([]int{1}) and rapidash.IntsPtr(v) ( ※ v is *[]int type ) for encoding and decoding .

Struct type

Struct type can encode/decode by (*rapidash.Struct).Cast() like the following.


type User struct {
  ID int64
  Name string
}

func (u *User) EncodeRapidash(enc rapidash.Encoder) error {
    enc.Int64("id", u.ID)
    enc.String("name", u.Name)
    return enc.Error()
}

func (u *User) DecodeRapidash(dec rapidash.Decoder) error {
    u.ID = dec.Int64("id")
    u.Name = dec.String("name")
    return dec.Error()
}

func (u *User) Struct() *rapidash.Struct {
    return rapidash.NewStruct("users").FieldInt64("id").FieldString("name")
}

UserType := new(User).Struct()
tx.Create("user", UserType.Cast(&User{ID: 1, Name: "john"})) // encode

var user User
tx.Find("user", UserType.Cast(&user)) // decode
Struct Slice Type

Struct Slice type can encode/decode by rapidash.Structs() like the following.


type Users []*User

func (u *Users) EncodeRapidash(enc rapidash.Encoder) error {
	for _, v := range *u {
		if err := v.EncodeRapidash(enc.New()); err != nil {
			return err
		}
	}
	return nil
}

func (u *Users) DecodeRapidash(dec rapidash.Decoder) error {
	len := dec.Len()
	*u = make([]*User, len)
	for i := 0; i < len; i++ {
		var v User
		if err := v.DecodeRapidash(dec.At(i)); err != nil {
			return err
		}
		(*u)[i] = &v
	}
	return nil
}

UserType := new(User).Struct()
users := Users{}
users = append(users, &User{ID: 1, Name: "john"})
tx.Create("user", rapidash.Structs(users, UserType)) // encode

var u Users
tx.Find("user", rapidash.Structs(&u, UserType)) // decode
5.3.2 Example

※ Previously, we start memcached with 11211 port.

package main

import (
	"go.knocknote.io/rapidash"
)

func main() {
	// Create `*rapidash.Rapidash` instance with ServerAddrs option
	cache, err := rapidash.New(rapidash.ServerAddrs([]string{"localhost:11211"}))
	if err != nil {
		panic(err)
	}
	tx, err := cache.Begin()
	if err != nil {
		panic(err)
	}
	
	// Create cache for int value
	if err := tx.Create("key", rapidash.Int(1)); err != nil {
		panic(err)
	}

	// Get cache for int value
	var v int
	if err := tx.Find("key", rapidash.IntPtr(&v)); err != nil {
		panic(err)
	}

	// Set cache to memcached
	if err := tx.Commit(); err != nil {
		panic(err)
	}
}

6. Committers

7. LICENSE

MIT

Documentation

Index

Constants

View Source
const (
	Order     = 4
	BranchNum = Order
	KeyNum    = Order - 1
)
View Source
const (
	CacheKeyQueryDelimiter         = "&"
	CacheKeyQueryKeyValueDelimiter = "#"
)

Variables

View Source
var (
	ErrBeginTransaction            = xerrors.New("failed begin cache transaction. required single connection instance or nothing")
	ErrConnectionOfTransaction     = xerrors.New("connection instance ( like sql.DB or sql.Tx ) is required for (*Rapidash).Begin()")
	ErrAlreadyCommittedTransaction = xerrors.New("transaction is already committed")
	ErrUnlockCacheKeys             = xerrors.New("failed unlock cache keys")
	ErrCacheCommit                 = xerrors.New("failed cache commit")
	ErrCleanUpCache                = xerrors.New("failed clean up cache")
	ErrRecoverCache                = xerrors.New("failed recover cache")
)
View Source
var (
	ErrInvalidQuery         = xerrors.New("query builder includes not equal query")
	ErrLookUpIndexFromQuery = xerrors.New("cannot lookup index from query")
	ErrMultipleINQueries    = xerrors.New("multiple IN queries are not supported")
	ErrInvalidColumnType    = xerrors.New("invalid column type")
)
View Source
var (
	ErrRecordNotFoundByPrimaryKey = xerrors.New("cannot find record by primary key")
	ErrInvalidLeafs               = xerrors.New("failed to find values. ( invalid leafs )")
)
View Source
var (
	ErrCacheMiss                           = xerrors.New("cache miss hit")
	ErrCreatePrimaryKeyCacheBySlice        = xerrors.New("cannot create cache for primary key with slice value")
	ErrCreateUniqueKeyCacheBySlice         = xerrors.New("cannot create cache for unique key with slice value")
	ErrCreateCacheKeyAtMultiplePrimaryKeys = xerrors.New("cannot find by primary key because table is set multiple primary keys")
)
View Source
var (
	ErrScanToNilValue    = xerrors.New("cannot scan to nil value")
	ErrUnknownColumnType = xerrors.New("unknown column type")
	ErrUnknownColumnName = xerrors.New("unknown column name")
	ErrInvalidDecodeType = xerrors.New("invalid decode type")
	ErrInvalidEncodeType = xerrors.New("invalid encode type")
)
View Source
var (
	ErrInvalidCacheKey = xerrors.New("invalid cache key")
)

Functions

func IsCacheMiss added in v0.0.3

func IsCacheMiss(err error) bool

func IsMaxIdleConnections added in v0.0.3

func IsMaxIdleConnections(err error) bool

func IsTimeout added in v0.0.3

func IsTimeout(err error) bool

Types

type BTree

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

func NewBTree

func NewBTree() *BTree

type BoolCoder

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

func Bool

func Bool(v bool) *BoolCoder

func BoolPtr

func BoolPtr(v *bool) *BoolCoder

func (*BoolCoder) Decode

func (c *BoolCoder) Decode(content []byte) error

func (*BoolCoder) Encode

func (c *BoolCoder) Encode() ([]byte, error)

type BoolsCoder

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

func Bools

func Bools(v []bool) *BoolsCoder

func BoolsPtr

func BoolsPtr(v *[]bool) *BoolsCoder

func (*BoolsCoder) Decode

func (c *BoolsCoder) Decode(content []byte) error

func (*BoolsCoder) Encode

func (c *BoolsCoder) Encode() ([]byte, error)

type BytesCoder

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

func Bytes

func Bytes(v []byte) *BytesCoder

func BytesPtr

func BytesPtr(v *[]byte) *BytesCoder

func (*BytesCoder) Decode

func (c *BytesCoder) Decode(content []byte) error

func (*BytesCoder) Encode

func (c *BytesCoder) Encode() ([]byte, error)

type CacheControlConfig

type CacheControlConfig struct {
	OptimisticLock  *bool `yaml:"optimistic_lock"`
	PessimisticLock *bool `yaml:"pessimistic_lock"`
}

func (*CacheControlConfig) LLCOptions

func (cfg *CacheControlConfig) LLCOptions() []OptionFunc

func (*CacheControlConfig) SLCOptions

func (cfg *CacheControlConfig) SLCOptions() []OptionFunc

func (*CacheControlConfig) TableOptions

func (cfg *CacheControlConfig) TableOptions(table string) []OptionFunc

func (*CacheControlConfig) TagOptions added in v0.3.0

func (cfg *CacheControlConfig) TagOptions(tag string) []OptionFunc

type CacheKey

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

func (CacheKey) Addr

func (c CacheKey) Addr() net.Addr

func (CacheKey) Hash

func (c CacheKey) Hash() uint32

func (CacheKey) LockKey

func (c CacheKey) LockKey() server.CacheKey

func (CacheKey) String

func (c CacheKey) String() string

func (CacheKey) Type

func (c CacheKey) Type() server.CacheKeyType

type CacheServerType

type CacheServerType int
const (
	CacheServerTypeMemcached CacheServerType = iota
	CacheServerTypeRedis
	CacheServerTypeOnMemory

	// DefaultTimeout is the default socket read/write timeout.
	DefaultTimeout = 100 * time.Millisecond
	// DefaultMaxIdleConns is the default maximum number of idle connections
	// kept for any single address.
	DefaultMaxIdleConns = 2
)

type Coder

type Coder interface {
	Marshaler
	Unmarshaler
}

type Condition

type Condition interface {
	Value() *Value
	Column() string
	Compare(v *Value) bool
	Search(*BTree) []Leaf
	Query() string
	QueryArgs() []interface{}
	Build(*ValueFactory)
	Release()
}

type Conditions

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

func (*Conditions) Append

func (c *Conditions) Append(condition Condition)

func (*Conditions) Build

func (c *Conditions) Build(factory *ValueFactory)

func (*Conditions) Columns

func (c *Conditions) Columns() []string

func (*Conditions) Current

func (c *Conditions) Current() Condition

func (*Conditions) Len

func (c *Conditions) Len() int

func (*Conditions) Next

func (c *Conditions) Next() *Conditions

func (*Conditions) Queries

func (c *Conditions) Queries() []string

func (*Conditions) Release

func (c *Conditions) Release()

func (*Conditions) Reset

func (c *Conditions) Reset()

type Config

type Config struct {
	Rule *RuleConfig `yaml:"rule"`
	SLC  *SLCConfig  `yaml:"slc"`
	LLC  *LLCConfig  `yaml:"llc"`
}

func NewConfig

func NewConfig(path string) (*Config, error)

func (*Config) Options

func (cfg *Config) Options() []OptionFunc

type Connection

type Connection interface {
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
}

type Decoder

type Decoder interface {
	Len() int
	At(int) Decoder
	Int(string) int
	Int8(string) int8
	Int16(string) int16
	Int32(string) int32
	Int64(string) int64
	Uint(string) uint
	Uint8(string) uint8
	Uint16(string) uint16
	Uint32(string) uint32
	Uint64(string) uint64
	Float32(string) float32
	Float64(string) float64
	Bool(string) bool
	String(string) string
	Bytes(string) []byte
	Time(string) time.Time
	Slice(string, Unmarshaler)
	Struct(string, Unmarshaler)
	IntPtr(string) *int
	Int8Ptr(string) *int8
	Int16Ptr(string) *int16
	Int32Ptr(string) *int32
	Int64Ptr(string) *int64
	UintPtr(string) *uint
	Uint8Ptr(string) *uint8
	Uint16Ptr(string) *uint16
	Uint32Ptr(string) *uint32
	Uint64Ptr(string) *uint64
	Float32Ptr(string) *float32
	Float64Ptr(string) *float64
	BoolPtr(string) *bool
	StringPtr(string) *string
	BytesPtr(string) *[]byte
	TimePtr(string) *time.Time
	Ints(string) []int
	Int8s(string) []int8
	Int16s(string) []int16
	Int32s(string) []int32
	Int64s(string) []int64
	Uints(string) []uint
	Uint8s(string) []uint8
	Uint16s(string) []uint16
	Uint32s(string) []uint32
	Uint64s(string) []uint64
	Float32s(string) []float32
	Float64s(string) []float64
	Bools(string) []bool
	Strings(string) []string
	Times(string) []time.Time
	Error() error
}

type DefaultLogger

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

func (*DefaultLogger) Add

func (dl *DefaultLogger) Add(id string, key server.CacheKey, value LogEncoder)

func (*DefaultLogger) Delete

func (dl *DefaultLogger) Delete(id string, typ SLCType, key server.CacheKey)

func (*DefaultLogger) DeleteFromDB

func (dl *DefaultLogger) DeleteFromDB(id, sql string)

func (*DefaultLogger) Get

func (dl *DefaultLogger) Get(id string, typ SLCType, key server.CacheKey, value LogEncoder)

func (*DefaultLogger) GetFromDB

func (dl *DefaultLogger) GetFromDB(id, sql string, args interface{}, value LogEncoder)

func (*DefaultLogger) GetMulti

func (dl *DefaultLogger) GetMulti(id string, typ SLCType, key []server.CacheKey, value LogEncoder)

func (*DefaultLogger) InsertIntoDB

func (dl *DefaultLogger) InsertIntoDB(id, sql string, args interface{}, value LogEncoder)

func (*DefaultLogger) Set

func (dl *DefaultLogger) Set(id string, typ SLCType, key server.CacheKey, value LogEncoder)

func (*DefaultLogger) Update

func (dl *DefaultLogger) Update(id string, typ SLCType, key server.CacheKey, value LogEncoder)

func (*DefaultLogger) UpdateForDB

func (dl *DefaultLogger) UpdateForDB(id, sql string, args interface{}, value LogEncoder)

func (*DefaultLogger) Warn

func (*DefaultLogger) Warn(msg string)

type EQCondition

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

func (*EQCondition) Build

func (c *EQCondition) Build(factory *ValueFactory)

func (*EQCondition) Column

func (c *EQCondition) Column() string

func (*EQCondition) Compare

func (c *EQCondition) Compare(value *Value) bool

func (*EQCondition) Query

func (c *EQCondition) Query() string

func (*EQCondition) QueryArgs

func (c *EQCondition) QueryArgs() []interface{}

func (*EQCondition) Release

func (c *EQCondition) Release()

func (*EQCondition) Search

func (c *EQCondition) Search(tree *BTree) []Leaf

func (*EQCondition) Value

func (c *EQCondition) Value() *Value

type Encoder

type Encoder interface {
	Error() error
	New() Encoder

	Int(string, int)
	Int8(string, int8)
	Int16(string, int16)
	Int32(string, int32)
	Int64(string, int64)
	Uint(string, uint)
	Uint8(string, uint8)
	Uint16(string, uint16)
	Uint32(string, uint32)
	Uint64(string, uint64)
	Float32(string, float32)
	Float64(string, float64)
	String(string, string)
	Bytes(string, []byte)
	Bool(string, bool)
	Time(string, time.Time)

	IntPtr(string, *int)
	Int8Ptr(string, *int8)
	Int16Ptr(string, *int16)
	Int32Ptr(string, *int32)
	Int64Ptr(string, *int64)
	UintPtr(string, *uint)
	Uint8Ptr(string, *uint8)
	Uint16Ptr(string, *uint16)
	Uint32Ptr(string, *uint32)
	Uint64Ptr(string, *uint64)
	Float32Ptr(string, *float32)
	Float64Ptr(string, *float64)
	StringPtr(string, *string)
	BytesPtr(string, *[]byte)
	BoolPtr(string, *bool)
	TimePtr(string, *time.Time)
	Struct(string, Marshaler)

	Ints(string, []int)
	Int8s(string, []int8)
	Int16s(string, []int16)
	Int32s(string, []int32)
	Int64s(string, []int64)
	Uints(string, []uint)
	Uint8s(string, []uint8)
	Uint16s(string, []uint16)
	Uint32s(string, []uint32)
	Uint64s(string, []uint64)
	Float32s(string, []float32)
	Float64s(string, []float64)
	Strings(string, []string)
	Bools(string, []bool)
	Times(string, []time.Time)
	Structs(string, Marshaler)
}

type FirstLevelCache

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

func NewFirstLevelCache

func NewFirstLevelCache(s *Struct) *FirstLevelCache

func (*FirstLevelCache) CountByQueryBuilder

func (c *FirstLevelCache) CountByQueryBuilder(builder *QueryBuilder) (uint64, error)

func (*FirstLevelCache) FindAll

func (c *FirstLevelCache) FindAll(unmarshaler Unmarshaler) error

func (*FirstLevelCache) FindByPrimaryKey

func (c *FirstLevelCache) FindByPrimaryKey(key *Value, unmarshaler Unmarshaler) error

func (*FirstLevelCache) FindByQueryBuilder

func (c *FirstLevelCache) FindByQueryBuilder(builder *QueryBuilder, unmarshaler Unmarshaler) error

func (*FirstLevelCache) WarmUp

func (c *FirstLevelCache) WarmUp(conn *sql.DB) (e error)

type FirstLevelCacheMap

type FirstLevelCacheMap struct {
	*sync.Map
}

func NewFirstLevelCacheMap

func NewFirstLevelCacheMap() *FirstLevelCacheMap

type Float32Coder

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

func Float32

func Float32(v float32) *Float32Coder

func Float32Ptr

func Float32Ptr(v *float32) *Float32Coder

func (*Float32Coder) Decode

func (c *Float32Coder) Decode(content []byte) error

func (*Float32Coder) Encode

func (c *Float32Coder) Encode() ([]byte, error)

type Float32sCoder

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

func Float32s

func Float32s(v []float32) *Float32sCoder

func Float32sPtr

func Float32sPtr(v *[]float32) *Float32sCoder

func (*Float32sCoder) Decode

func (c *Float32sCoder) Decode(content []byte) error

func (*Float32sCoder) Encode

func (c *Float32sCoder) Encode() ([]byte, error)

type Float64Coder

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

func Float64

func Float64(v float64) *Float64Coder

func Float64Ptr

func Float64Ptr(v *float64) *Float64Coder

func (*Float64Coder) Decode

func (c *Float64Coder) Decode(content []byte) error

func (*Float64Coder) Encode

func (c *Float64Coder) Encode() ([]byte, error)

type Float64sCoder

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

func Float64s

func Float64s(v []float64) *Float64sCoder

func Float64sPtr

func Float64sPtr(v *[]float64) *Float64sCoder

func (*Float64sCoder) Decode

func (c *Float64sCoder) Decode(content []byte) error

func (*Float64sCoder) Encode

func (c *Float64sCoder) Encode() ([]byte, error)

type GTCondition

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

func (*GTCondition) Build

func (c *GTCondition) Build(factory *ValueFactory)

func (*GTCondition) Column

func (c *GTCondition) Column() string

func (*GTCondition) Compare

func (c *GTCondition) Compare(value *Value) bool

func (*GTCondition) Query

func (c *GTCondition) Query() string

func (*GTCondition) QueryArgs

func (c *GTCondition) QueryArgs() []interface{}

func (*GTCondition) Release

func (c *GTCondition) Release()

func (*GTCondition) Search

func (c *GTCondition) Search(tree *BTree) []Leaf

func (*GTCondition) Value

func (c *GTCondition) Value() *Value

type GTECondition

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

func (*GTECondition) Build

func (c *GTECondition) Build(factory *ValueFactory)

func (*GTECondition) Column

func (c *GTECondition) Column() string

func (*GTECondition) Compare

func (c *GTECondition) Compare(value *Value) bool

func (*GTECondition) Query

func (c *GTECondition) Query() string

func (*GTECondition) QueryArgs

func (c *GTECondition) QueryArgs() []interface{}

func (*GTECondition) Release

func (c *GTECondition) Release()

func (*GTECondition) Search

func (c *GTECondition) Search(tree *BTree) []Leaf

func (*GTECondition) Value

func (c *GTECondition) Value() *Value

type INCondition

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

func (*INCondition) Build

func (c *INCondition) Build(factory *ValueFactory)

func (*INCondition) Column

func (c *INCondition) Column() string

func (*INCondition) Compare

func (c *INCondition) Compare(value *Value) bool

func (*INCondition) Query

func (c *INCondition) Query() string

func (*INCondition) QueryArgs

func (c *INCondition) QueryArgs() []interface{}

func (*INCondition) Release

func (c *INCondition) Release()

func (*INCondition) Search

func (c *INCondition) Search(tree *BTree) []Leaf

func (*INCondition) Value

func (c *INCondition) Value() *Value

type Index

type Index struct {
	Type          IndexType
	Table         string
	Option        *TableOption
	Columns       []string
	ColumnTypeMap map[string]TypeID
	// contains filtered or unexported fields
}

func NewKey

func NewKey(opt *TableOption, tableName string, columns []string, typ *Struct) *Index

func NewPrimaryKey

func NewPrimaryKey(opt *TableOption, tableName string, columns []string, typ *Struct) *Index

func NewUniqueKey

func NewUniqueKey(opt *TableOption, tableName string, columns []string, typ *Struct) *Index

func (*Index) CacheKey

func (i *Index) CacheKey(value *StructValue) (*CacheKey, error)

func (*Index) CacheKeys

func (i *Index) CacheKeys(slice *StructSliceValue) ([]server.CacheKey, error)

func (*Index) HasColumn

func (i *Index) HasColumn(col string) bool

type IndexType

type IndexType int
const (
	IndexTypeUniqueKey IndexType = iota
	IndexTypeKey
	IndexTypePrimaryKey
)

type Int16Coder

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

func Int16

func Int16(v int16) *Int16Coder

func Int16Ptr

func Int16Ptr(v *int16) *Int16Coder

func (*Int16Coder) Decode

func (c *Int16Coder) Decode(content []byte) error

func (*Int16Coder) Encode

func (c *Int16Coder) Encode() ([]byte, error)

type Int16sCoder

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

func Int16s

func Int16s(v []int16) *Int16sCoder

func Int16sPtr

func Int16sPtr(v *[]int16) *Int16sCoder

func (*Int16sCoder) Decode

func (c *Int16sCoder) Decode(content []byte) error

func (*Int16sCoder) Encode

func (c *Int16sCoder) Encode() ([]byte, error)

type Int32Coder

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

func Int32

func Int32(v int32) *Int32Coder

func Int32Ptr

func Int32Ptr(v *int32) *Int32Coder

func (*Int32Coder) Decode

func (c *Int32Coder) Decode(content []byte) error

func (*Int32Coder) Encode

func (c *Int32Coder) Encode() ([]byte, error)

type Int32sCoder

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

func Int32s

func Int32s(v []int32) *Int32sCoder

func Int32sPtr

func Int32sPtr(v *[]int32) *Int32sCoder

func (*Int32sCoder) Decode

func (c *Int32sCoder) Decode(content []byte) error

func (*Int32sCoder) Encode

func (c *Int32sCoder) Encode() ([]byte, error)

type Int64Coder

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

func Int64

func Int64(v int64) *Int64Coder

func Int64Ptr

func Int64Ptr(v *int64) *Int64Coder

func (*Int64Coder) Decode

func (c *Int64Coder) Decode(content []byte) error

func (*Int64Coder) Encode

func (c *Int64Coder) Encode() ([]byte, error)

type Int64sCoder

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

func Int64s

func Int64s(v []int64) *Int64sCoder

func Int64sPtr

func Int64sPtr(v *[]int64) *Int64sCoder

func (*Int64sCoder) Decode

func (c *Int64sCoder) Decode(content []byte) error

func (*Int64sCoder) Encode

func (c *Int64sCoder) Encode() ([]byte, error)

type Int8Coder

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

func Int8

func Int8(v int8) *Int8Coder

func Int8Ptr

func Int8Ptr(v *int8) *Int8Coder

func (*Int8Coder) Decode

func (c *Int8Coder) Decode(content []byte) error

func (*Int8Coder) Encode

func (c *Int8Coder) Encode() ([]byte, error)

type Int8sCoder

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

func Int8s

func Int8s(v []int8) *Int8sCoder

func Int8sPtr

func Int8sPtr(v *[]int8) *Int8sCoder

func (*Int8sCoder) Decode

func (c *Int8sCoder) Decode(content []byte) error

func (*Int8sCoder) Encode

func (c *Int8sCoder) Encode() ([]byte, error)

type IntCoder

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

func Int

func Int(v int) *IntCoder

func IntPtr

func IntPtr(v *int) *IntCoder

func (*IntCoder) Decode

func (c *IntCoder) Decode(content []byte) error

func (*IntCoder) Encode

func (c *IntCoder) Encode() ([]byte, error)

type IntsCoder

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

func Ints

func Ints(v []int) *IntsCoder

func IntsPtr

func IntsPtr(v *[]int) *IntsCoder

func (*IntsCoder) Decode

func (c *IntsCoder) Decode(content []byte) error

func (*IntsCoder) Encode

func (c *IntsCoder) Encode() ([]byte, error)

type LLCConfig

type LLCConfig struct {
	Servers        *[]string
	Tags           *map[string]*TagConfig `yaml:"tags"`
	CacheControl   *CacheControlConfig    `yaml:"cache_control"`
	Expiration     *time.Duration         `yaml:"expiration"`
	LockExpiration *time.Duration         `yaml:"lock_expiration"`
}

func (*LLCConfig) Options

func (cfg *LLCConfig) Options() []OptionFunc

type LTCondition

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

func (*LTCondition) Build

func (c *LTCondition) Build(factory *ValueFactory)

func (*LTCondition) Column

func (c *LTCondition) Column() string

func (*LTCondition) Compare

func (c *LTCondition) Compare(value *Value) bool

func (*LTCondition) Query

func (c *LTCondition) Query() string

func (*LTCondition) QueryArgs

func (c *LTCondition) QueryArgs() []interface{}

func (*LTCondition) Release

func (c *LTCondition) Release()

func (*LTCondition) Search

func (c *LTCondition) Search(tree *BTree) []Leaf

func (*LTCondition) Value

func (c *LTCondition) Value() *Value

type LTECondition

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

func (*LTECondition) Build

func (c *LTECondition) Build(factory *ValueFactory)

func (*LTECondition) Column

func (c *LTECondition) Column() string

func (*LTECondition) Compare

func (c *LTECondition) Compare(value *Value) bool

func (*LTECondition) Query

func (c *LTECondition) Query() string

func (*LTECondition) QueryArgs

func (c *LTECondition) QueryArgs() []interface{}

func (*LTECondition) Release

func (c *LTECondition) Release()

func (*LTECondition) Search

func (c *LTECondition) Search(tree *BTree) []Leaf

func (*LTECondition) Value

func (c *LTECondition) Value() *Value

type LastLevelCache

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

func NewLastLevelCache

func NewLastLevelCache(cacheServer server.CacheServer, opt *LastLevelCacheOption) *LastLevelCache

func (*LastLevelCache) Create

func (c *LastLevelCache) Create(tx *Tx, tag, key string, value Type, expiration time.Duration) error

func (*LastLevelCache) Delete

func (c *LastLevelCache) Delete(tx *Tx, tag, key string) error

func (*LastLevelCache) Find

func (c *LastLevelCache) Find(tx *Tx, tag, key string, value Type) error

func (*LastLevelCache) Update

func (c *LastLevelCache) Update(tx *Tx, tag, key string, value Type, expiration time.Duration) error

type LastLevelCacheOption

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

type Leaf

type Leaf interface {
}

type LockingReadOption added in v0.0.13

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

func (*LockingReadOption) String added in v0.0.13

func (o *LockingReadOption) String() string

type LogEncoder

type LogEncoder interface {
	EncodeLog() string
}

type LogMap

type LogMap map[string]interface{}

func (LogMap) EncodeLog

func (m LogMap) EncodeLog() string

type LogModeType

type LogModeType int
const (
	LogModeConsole LogModeType = iota
	LogModeJSON
	LogModeServerDebug
)

type LogString

type LogString string

func (LogString) EncodeLog

func (s LogString) EncodeLog() string

type LogStrings

type LogStrings []server.CacheKey

func (LogStrings) EncodeLog

func (l LogStrings) EncodeLog() string

type Logger

type Logger interface {
	Warn(msg string)
	Add(string, server.CacheKey, LogEncoder)
	Get(string, SLCType, server.CacheKey, LogEncoder)
	GetFromDB(string, string, interface{}, LogEncoder)
	GetMulti(string, SLCType, []server.CacheKey, LogEncoder)
	Set(string, SLCType, server.CacheKey, LogEncoder)
	InsertIntoDB(string, string, interface{}, LogEncoder)
	Update(string, SLCType, server.CacheKey, LogEncoder)
	UpdateForDB(string, string, interface{}, LogEncoder)
	Delete(string, SLCType, server.CacheKey)
	DeleteFromDB(string, string)
}

type LoggerConfig

type LoggerConfig struct {
	Mode    *string `yaml:"mode"`
	Enabled *bool   `yaml:"enabled"`
}

func (*LoggerConfig) Options

func (cfg *LoggerConfig) Options() []OptionFunc

type Marshaler

type Marshaler interface {
	EncodeRapidash(Encoder) error
}

type NEQCondition

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

func (*NEQCondition) Build

func (c *NEQCondition) Build(factory *ValueFactory)

func (*NEQCondition) Column

func (c *NEQCondition) Column() string

func (*NEQCondition) Compare

func (c *NEQCondition) Compare(value *Value) bool

func (*NEQCondition) Query

func (c *NEQCondition) Query() string

func (*NEQCondition) QueryArgs

func (c *NEQCondition) QueryArgs() []interface{}

func (*NEQCondition) Release

func (c *NEQCondition) Release()

func (*NEQCondition) Search

func (c *NEQCondition) Search(tree *BTree) []Leaf

func (*NEQCondition) Value

func (c *NEQCondition) Value() *Value

type Node

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

func NewNode

func NewNode() *Node

type NopLogger

type NopLogger struct{}

func (*NopLogger) Add

func (*NopLogger) Add(id string, key server.CacheKey, value LogEncoder)

func (*NopLogger) Delete

func (*NopLogger) Delete(id string, typ SLCType, key server.CacheKey)

func (*NopLogger) DeleteFromDB

func (*NopLogger) DeleteFromDB(id, sql string)

func (*NopLogger) Get

func (*NopLogger) Get(id string, typ SLCType, key server.CacheKey, value LogEncoder)

func (*NopLogger) GetFromDB

func (*NopLogger) GetFromDB(id, sql string, args interface{}, value LogEncoder)

func (*NopLogger) GetMulti

func (*NopLogger) GetMulti(id string, typ SLCType, key []server.CacheKey, value LogEncoder)

func (*NopLogger) InsertIntoDB

func (*NopLogger) InsertIntoDB(id, sql string, args interface{}, value LogEncoder)

func (*NopLogger) Set

func (*NopLogger) Set(id string, typ SLCType, key server.CacheKey, value LogEncoder)

func (*NopLogger) Update

func (*NopLogger) Update(id string, typ SLCType, key server.CacheKey, value LogEncoder)

func (*NopLogger) UpdateForDB

func (*NopLogger) UpdateForDB(id, sql string, args interface{}, value LogEncoder)

func (*NopLogger) Warn

func (*NopLogger) Warn(msg string)

type Option

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

type OptionFunc

type OptionFunc func(*Rapidash)

func LastLevelCacheExpiration

func LastLevelCacheExpiration(expiration time.Duration) OptionFunc

func LastLevelCacheLockExpiration

func LastLevelCacheLockExpiration(expiration time.Duration) OptionFunc

func LastLevelCacheOptimisticLock

func LastLevelCacheOptimisticLock(enabled bool) OptionFunc

func LastLevelCachePessimisticLock

func LastLevelCachePessimisticLock(enabled bool) OptionFunc

func LastLevelCacheServerAddrs

func LastLevelCacheServerAddrs(addrs []string) OptionFunc

func LastLevelCacheTagExpiration

func LastLevelCacheTagExpiration(tag string, expiration time.Duration) OptionFunc

func LastLevelCacheTagIgnoreStash added in v0.1.0

func LastLevelCacheTagIgnoreStash(tag string) OptionFunc

func LastLevelCacheTagLockExpiration

func LastLevelCacheTagLockExpiration(tag string, expiration time.Duration) OptionFunc

func LastLevelCacheTagOptimisticLock added in v0.3.0

func LastLevelCacheTagOptimisticLock(tag string, enabled bool) OptionFunc

func LastLevelCacheTagPessimisticLock added in v0.3.0

func LastLevelCacheTagPessimisticLock(tag string, enabled bool) OptionFunc

func LastLevelCacheTagServerAddr

func LastLevelCacheTagServerAddr(tag string, serverAddr string) OptionFunc

func LogEnabled

func LogEnabled(enabled bool) OptionFunc

func LogMode

func LogMode(mode LogModeType) OptionFunc

func LogServerAddr

func LogServerAddr(addr string) OptionFunc

func MaxIdleConnections

func MaxIdleConnections(cons int) OptionFunc

func MaxRetryCount

func MaxRetryCount(cnt int) OptionFunc

func RetryInterval

func RetryInterval(interval time.Duration) OptionFunc

func SecondLevelCacheExpiration

func SecondLevelCacheExpiration(expiration time.Duration) OptionFunc

func SecondLevelCacheLockExpiration

func SecondLevelCacheLockExpiration(expiration time.Duration) OptionFunc

func SecondLevelCacheOptimisticLock

func SecondLevelCacheOptimisticLock(enabled bool) OptionFunc

func SecondLevelCachePessimisticLock

func SecondLevelCachePessimisticLock(enabled bool) OptionFunc

func SecondLevelCacheServerAddrs

func SecondLevelCacheServerAddrs(addrs []string) OptionFunc

func SecondLevelCacheTableExpiration

func SecondLevelCacheTableExpiration(table string, expiration time.Duration) OptionFunc

func SecondLevelCacheTableLockExpiration

func SecondLevelCacheTableLockExpiration(table string, expiration time.Duration) OptionFunc

func SecondLevelCacheTableOptimisticLock

func SecondLevelCacheTableOptimisticLock(table string, enabled bool) OptionFunc

func SecondLevelCacheTablePessimisticLock

func SecondLevelCacheTablePessimisticLock(table string, enabled bool) OptionFunc

func SecondLevelCacheTableServerAddr

func SecondLevelCacheTableServerAddr(table string, serverAddr string) OptionFunc

func SecondLevelCacheTableShardKey

func SecondLevelCacheTableShardKey(table string, shardKey string) OptionFunc

func ServerAddrs

func ServerAddrs(addrs []string) OptionFunc

func ServerType

func ServerType(typ CacheServerType) OptionFunc

func Timeout

func Timeout(timeout time.Duration) OptionFunc

type OrderCondition

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

type PendingQuery

type PendingQuery struct {
	*QueryLog
	// contains filtered or unexported fields
}

type PrimaryKeyDecoder

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

func NewPrimaryKeyDecoder

func NewPrimaryKeyDecoder(buf *bytes.Buffer) *PrimaryKeyDecoder

func (*PrimaryKeyDecoder) Decode

func (d *PrimaryKeyDecoder) Decode() (string, error)

func (*PrimaryKeyDecoder) SetBuffer

func (d *PrimaryKeyDecoder) SetBuffer(content []byte)

type Queries

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

func NewQueries

func NewQueries(tableName string, primaryIndex *Index, queryNum int) *Queries

func (*Queries) Add

func (q *Queries) Add(query *Query)

func (*Queries) At

func (q *Queries) At(idx int) *Query

func (*Queries) CacheMissQueries

func (q *Queries) CacheMissQueries() []*Query

func (*Queries) CacheMissQueriesToSQL

func (q *Queries) CacheMissQueriesToSQL(typ *Struct) (string, []interface{})

func (*Queries) Each

func (q *Queries) Each(iter func(*Query) error) error

func (*Queries) FindCacheMissQueryByStructValue

func (q *Queries) FindCacheMissQueryByStructValue(value *StructValue) *Query

func (*Queries) Len

func (q *Queries) Len() int

func (*Queries) LoadValues

func (q *Queries) LoadValues(factory *ValueFactory, primaryKeyLoader func(IndexType, *QueryIterator) error, valueLoader func(*ValueIterator) error) (*StructSliceValue, error)

type Query

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

func NewQuery

func NewQuery(columnNum int) *Query

func (*Query) Add

func (q *Query) Add(condition Condition)

func (*Query) Field

func (q *Query) Field(column string) *Value

func (*Query) Index

func (q *Query) Index() *Index

func (*Query) SetIndex

func (q *Query) SetIndex(index *Index) error

type QueryBuilder

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

func NewQueryBuilder

func NewQueryBuilder(tableName string) *QueryBuilder

func (*QueryBuilder) AvailableCache

func (b *QueryBuilder) AvailableCache() bool

func (*QueryBuilder) AvailableIndex

func (b *QueryBuilder) AvailableIndex() bool

func (*QueryBuilder) Build

func (b *QueryBuilder) Build(factory *ValueFactory)

func (*QueryBuilder) BuildWithIndex

func (b *QueryBuilder) BuildWithIndex(factory *ValueFactory, indexes map[string]*Index, typ *Struct) (*Queries, error)

func (*QueryBuilder) Conditions

func (b *QueryBuilder) Conditions() *Conditions

func (*QueryBuilder) DeleteSQL

func (b *QueryBuilder) DeleteSQL() (string, []interface{})

func (*QueryBuilder) Eq

func (b *QueryBuilder) Eq(column string, value interface{}) *QueryBuilder

func (*QueryBuilder) Fields

func (b *QueryBuilder) Fields() map[string]*Value

func (*QueryBuilder) ForUpdate added in v0.0.13

func (b *QueryBuilder) ForUpdate() *QueryBuilder

func (*QueryBuilder) Gt

func (b *QueryBuilder) Gt(column string, value interface{}) *QueryBuilder

func (*QueryBuilder) Gte

func (b *QueryBuilder) Gte(column string, value interface{}) *QueryBuilder

func (*QueryBuilder) In

func (b *QueryBuilder) In(column string, values interface{}) *QueryBuilder

func (*QueryBuilder) Index

func (b *QueryBuilder) Index() string

func (*QueryBuilder) IsUnsupportedCacheQuery

func (b *QueryBuilder) IsUnsupportedCacheQuery() bool

func (*QueryBuilder) LockInShareMode added in v0.0.13

func (b *QueryBuilder) LockInShareMode() *QueryBuilder

func (*QueryBuilder) Lt

func (b *QueryBuilder) Lt(column string, value interface{}) *QueryBuilder

func (*QueryBuilder) Lte

func (b *QueryBuilder) Lte(column string, value interface{}) *QueryBuilder

func (*QueryBuilder) Neq

func (b *QueryBuilder) Neq(column string, value interface{}) *QueryBuilder

func (*QueryBuilder) OrderAsc

func (b *QueryBuilder) OrderAsc(column string) *QueryBuilder

func (*QueryBuilder) OrderBy

func (b *QueryBuilder) OrderBy(column string) *QueryBuilder

func (*QueryBuilder) OrderDesc

func (b *QueryBuilder) OrderDesc(column string) *QueryBuilder

func (*QueryBuilder) Query

func (b *QueryBuilder) Query() string

func (*QueryBuilder) Release

func (b *QueryBuilder) Release()

func (*QueryBuilder) SQL

func (b *QueryBuilder) SQL(stmt string, values ...interface{}) *QueryBuilder

func (*QueryBuilder) SelectSQL

func (b *QueryBuilder) SelectSQL(typ *Struct) (string, []interface{})

func (*QueryBuilder) UpdateSQL

func (b *QueryBuilder) UpdateSQL(updateMap map[string]interface{}) (string, []interface{})

type QueryIterator

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

func NewQueryIterator

func NewQueryIterator(queries []*Query) *QueryIterator

func (*QueryIterator) Error

func (i *QueryIterator) Error() error

func (*QueryIterator) Key

func (i *QueryIterator) Key() server.CacheKey

func (*QueryIterator) Next

func (i *QueryIterator) Next() bool

func (*QueryIterator) PrimaryKeys

func (i *QueryIterator) PrimaryKeys() []server.CacheKey

func (*QueryIterator) Query

func (i *QueryIterator) Query() *Query

func (*QueryIterator) QueryByPrimaryKey

func (i *QueryIterator) QueryByPrimaryKey(primaryKey server.CacheKey) *Query

func (*QueryIterator) Reset

func (i *QueryIterator) Reset()

func (*QueryIterator) SetError

func (i *QueryIterator) SetError(err error)

func (*QueryIterator) SetErrorWithKey

func (i *QueryIterator) SetErrorWithKey(key server.CacheKey, err error)

func (*QueryIterator) SetPrimaryKey

func (i *QueryIterator) SetPrimaryKey(primaryKey server.CacheKey)

func (*QueryIterator) SetPrimaryKeyWithKey

func (i *QueryIterator) SetPrimaryKeyWithKey(key, primaryKey server.CacheKey)

func (*QueryIterator) SetPrimaryKeys

func (i *QueryIterator) SetPrimaryKeys(primaryKeys []server.CacheKey)

func (*QueryIterator) SetPrimaryKeysWithKey

func (i *QueryIterator) SetPrimaryKeysWithKey(key server.CacheKey, primaryKeys []server.CacheKey)

type QueryLog

type QueryLog struct {
	Command string              `json:"command"`
	Key     string              `json:"key"`
	Hash    uint32              `json:"hash"`
	Type    server.CacheKeyType `json:"type"`
	Addr    string              `json:"addr"`
}

type QueryResult

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

type Rapidash

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

func New

func New(opts ...OptionFunc) (*Rapidash, error)

func (*Rapidash) AddLastLevelCacheServer

func (r *Rapidash) AddLastLevelCacheServer(servers ...string) error

func (*Rapidash) AddSecondLevelCacheServer

func (r *Rapidash) AddSecondLevelCacheServer(servers ...string) error

func (*Rapidash) AddServers

func (r *Rapidash) AddServers(servers ...string) error

func (*Rapidash) AfterCommitCallback

func (r *Rapidash) AfterCommitCallback(
	successCallback func(*Tx) error,
	failureCallback func(*Tx, []*QueryLog) error)

func (*Rapidash) BeforeCommitCallback

func (r *Rapidash) BeforeCommitCallback(callback func(*Tx, []*QueryLog) error)

func (*Rapidash) Begin

func (r *Rapidash) Begin(conns ...Connection) (*Tx, error)

func (*Rapidash) Flush

func (r *Rapidash) Flush() error

func (*Rapidash) Ignore

func (r *Rapidash) Ignore(conn *sql.DB, typ *Struct) error

Ignore read/write to database without cache access

func (*Rapidash) Recover

func (r *Rapidash) Recover(queries []*QueryLog) error

func (*Rapidash) RemoveLastLevelCacheServers

func (r *Rapidash) RemoveLastLevelCacheServers(servers ...string) error

func (*Rapidash) RemoveSecondLevelCacheServers

func (r *Rapidash) RemoveSecondLevelCacheServers(servers ...string) error

func (*Rapidash) RemoveServers

func (r *Rapidash) RemoveServers(servers ...string) error

func (*Rapidash) WarmUp

func (r *Rapidash) WarmUp(conn *sql.DB, typ *Struct, isReadOnly bool) error

func (*Rapidash) WarmUpFirstLevelCache

func (r *Rapidash) WarmUpFirstLevelCache(conn *sql.DB, typ *Struct) error

func (*Rapidash) WarmUpSecondLevelCache

func (r *Rapidash) WarmUpSecondLevelCache(conn *sql.DB, typ *Struct) error

type RetryConfig

type RetryConfig struct {
	Limit    *int           `yaml:"limit"`
	Interval *time.Duration `yaml:"interval"`
}

func (*RetryConfig) Options

func (cfg *RetryConfig) Options() []OptionFunc

type RuleConfig

type RuleConfig struct {
	Servers           *[]string           `yaml:"servers"`
	Logger            *LoggerConfig       `yaml:"logger"`
	Retry             *RetryConfig        `yaml:"retry"`
	CacheControl      *CacheControlConfig `yaml:"cache_control"`
	Timeout           *int                `yaml:"timeout"`
	MaxIdleConnection *int                `yaml:"max_idle_connection"`
}

func (*RuleConfig) Options

func (cfg *RuleConfig) Options() []OptionFunc

type SLCCommandType

type SLCCommandType string
const (
	SLCCommandGet      SLCCommandType = "get"
	SLCCommandSet      SLCCommandType = "set"
	SLCCommandGetMulti SLCCommandType = "get_multi"
	SLCCommandUpdate   SLCCommandType = "update"
	SLCCommandDelete   SLCCommandType = "delete"
	SLCCommandAdd      SLCCommandType = "add"
)

type SLCConfig

type SLCConfig struct {
	Servers        *[]string                `yaml:"servers"`
	Tables         *map[string]*TableConfig `yaml:"tables"`
	Expiration     *time.Duration           `yaml:"expiration"`
	LockExpiration *time.Duration           `yaml:"lock_expiration"`
}

func (*SLCConfig) Options

func (cfg *SLCConfig) Options() []OptionFunc

type SLCType

type SLCType string
const (
	SLCServer SLCType = "server"
	SLCStash  SLCType = "stash"
	SLCDB     SLCType = "db"
)

type SQLCondition

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

func (*SQLCondition) Build

func (c *SQLCondition) Build(factory *ValueFactory)

func (*SQLCondition) Release

func (c *SQLCondition) Release()

type SecondLevelCache

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

func NewSecondLevelCache

func NewSecondLevelCache(s *Struct, server server.CacheServer, opt TableOption) *SecondLevelCache

func (*SecondLevelCache) CountByQueryBuilder added in v0.0.7

func (c *SecondLevelCache) CountByQueryBuilder(ctx context.Context, tx *Tx, builder *QueryBuilder) (uint64, error)

func (*SecondLevelCache) Create

func (c *SecondLevelCache) Create(ctx context.Context, tx *Tx, marshaler Marshaler) (id int64, e error)

func (*SecondLevelCache) CreateWithoutCache

func (c *SecondLevelCache) CreateWithoutCache(ctx context.Context, tx *Tx, marshaler Marshaler) (id int64, e error)

func (*SecondLevelCache) DeleteByPrimaryKey

func (c *SecondLevelCache) DeleteByPrimaryKey(tx *Tx, v *Value) error

func (*SecondLevelCache) DeleteByQueryBuilder

func (c *SecondLevelCache) DeleteByQueryBuilder(ctx context.Context, tx *Tx, builder *QueryBuilder) error

func (*SecondLevelCache) FindByQueryBuilder

func (c *SecondLevelCache) FindByQueryBuilder(ctx context.Context, tx *Tx, builder *QueryBuilder, unmarshaler Unmarshaler) error

func (*SecondLevelCache) UpdateByPrimaryKey

func (c *SecondLevelCache) UpdateByPrimaryKey(tx *Tx, marshaler Marshaler) error

func (*SecondLevelCache) UpdateByQueryBuilder

func (c *SecondLevelCache) UpdateByQueryBuilder(ctx context.Context, tx *Tx, builder *QueryBuilder, updateMap map[string]interface{}) (e error)

func (*SecondLevelCache) WarmUp

func (c *SecondLevelCache) WarmUp(conn *sql.DB) error

type SecondLevelCacheMap

type SecondLevelCacheMap struct {
	*sync.Map
}

func NewSecondLevelCacheMap

func NewSecondLevelCacheMap() *SecondLevelCacheMap

type Selectors

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

type Stash

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

func NewStash

func NewStash() *Stash

type StringCoder

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

func String

func String(v string) *StringCoder

func StringPtr

func StringPtr(v *string) *StringCoder

func (*StringCoder) Decode

func (c *StringCoder) Decode(content []byte) error

func (*StringCoder) Encode

func (c *StringCoder) Encode() ([]byte, error)

type StringsCoder

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

func Strings

func Strings(v []string) *StringsCoder

func StringsPtr

func StringsPtr(v *[]string) *StringsCoder

func (*StringsCoder) Decode

func (c *StringsCoder) Decode(content []byte) error

func (*StringsCoder) Encode

func (c *StringsCoder) Encode() ([]byte, error)

type Struct

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

func NewStruct

func NewStruct(tableName string) *Struct

func (*Struct) Cast

func (s *Struct) Cast(coder Coder) Type

func (*Struct) Columns

func (s *Struct) Columns() []string

func (*Struct) FieldBool

func (s *Struct) FieldBool(column string) *Struct

func (*Struct) FieldBytes

func (s *Struct) FieldBytes(column string) *Struct

func (*Struct) FieldFloat32

func (s *Struct) FieldFloat32(column string) *Struct

func (*Struct) FieldFloat64

func (s *Struct) FieldFloat64(column string) *Struct

func (*Struct) FieldInt

func (s *Struct) FieldInt(column string) *Struct

func (*Struct) FieldInt16

func (s *Struct) FieldInt16(column string) *Struct

func (*Struct) FieldInt32

func (s *Struct) FieldInt32(column string) *Struct

func (*Struct) FieldInt64

func (s *Struct) FieldInt64(column string) *Struct

func (*Struct) FieldInt8

func (s *Struct) FieldInt8(column string) *Struct

func (*Struct) FieldSelfStruct

func (s *Struct) FieldSelfStruct(column string) *Struct

func (*Struct) FieldSelfStructSlice

func (s *Struct) FieldSelfStructSlice(column string) *Struct

func (*Struct) FieldSlice

func (s *Struct) FieldSlice(column string, typ TypeID) *Struct

func (*Struct) FieldString

func (s *Struct) FieldString(column string) *Struct

func (*Struct) FieldStruct

func (s *Struct) FieldStruct(column string, structType *Struct) *Struct

func (*Struct) FieldStructSlice

func (s *Struct) FieldStructSlice(column string, structType *Struct) *Struct

func (*Struct) FieldTime

func (s *Struct) FieldTime(column string) *Struct

func (*Struct) FieldUint

func (s *Struct) FieldUint(column string) *Struct

func (*Struct) FieldUint16

func (s *Struct) FieldUint16(column string) *Struct

func (*Struct) FieldUint32

func (s *Struct) FieldUint32(column string) *Struct

func (*Struct) FieldUint64

func (s *Struct) FieldUint64(column string) *Struct

func (*Struct) FieldUint8

func (s *Struct) FieldUint8(column string) *Struct

func (*Struct) ScanValues

func (s *Struct) ScanValues(factory *ValueFactory) []interface{}

func (*Struct) StructValue

func (s *Struct) StructValue(values []interface{}) *StructValue

type StructCoder

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

func (*StructCoder) Decode

func (c *StructCoder) Decode(content []byte) error

func (*StructCoder) Encode

func (c *StructCoder) Encode() ([]byte, error)

type StructEncoder

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

func NewStructEncoder

func NewStructEncoder(s *Struct, factory *ValueFactory) *StructEncoder

func (*StructEncoder) Bool

func (e *StructEncoder) Bool(column string, v bool)

func (*StructEncoder) BoolPtr

func (e *StructEncoder) BoolPtr(column string, v *bool)

func (*StructEncoder) Bools

func (e *StructEncoder) Bools(column string, v []bool)

func (*StructEncoder) Bytes

func (e *StructEncoder) Bytes(column string, v []byte)

func (*StructEncoder) BytesPtr

func (e *StructEncoder) BytesPtr(column string, v *[]byte)

func (*StructEncoder) Encode

func (e *StructEncoder) Encode() ([]byte, error)

func (*StructEncoder) EncodeSlice

func (e *StructEncoder) EncodeSlice() ([][]byte, error)

func (*StructEncoder) Error

func (e *StructEncoder) Error() error

func (*StructEncoder) Float32

func (e *StructEncoder) Float32(column string, v float32)

func (*StructEncoder) Float32Ptr

func (e *StructEncoder) Float32Ptr(column string, v *float32)

func (*StructEncoder) Float32s

func (e *StructEncoder) Float32s(column string, v []float32)

func (*StructEncoder) Float64

func (e *StructEncoder) Float64(column string, v float64)

func (*StructEncoder) Float64Ptr

func (e *StructEncoder) Float64Ptr(column string, v *float64)

func (*StructEncoder) Float64s

func (e *StructEncoder) Float64s(column string, v []float64)

func (*StructEncoder) Int

func (e *StructEncoder) Int(column string, v int)

func (*StructEncoder) Int16

func (e *StructEncoder) Int16(column string, v int16)

func (*StructEncoder) Int16Ptr

func (e *StructEncoder) Int16Ptr(column string, v *int16)

func (*StructEncoder) Int16s

func (e *StructEncoder) Int16s(column string, v []int16)

func (*StructEncoder) Int32

func (e *StructEncoder) Int32(column string, v int32)

func (*StructEncoder) Int32Ptr

func (e *StructEncoder) Int32Ptr(column string, v *int32)

func (*StructEncoder) Int32s

func (e *StructEncoder) Int32s(column string, v []int32)

func (*StructEncoder) Int64

func (e *StructEncoder) Int64(column string, v int64)

func (*StructEncoder) Int64Ptr

func (e *StructEncoder) Int64Ptr(column string, v *int64)

func (*StructEncoder) Int64s

func (e *StructEncoder) Int64s(column string, v []int64)

func (*StructEncoder) Int8

func (e *StructEncoder) Int8(column string, v int8)

func (*StructEncoder) Int8Ptr

func (e *StructEncoder) Int8Ptr(column string, v *int8)

func (*StructEncoder) Int8s

func (e *StructEncoder) Int8s(column string, v []int8)

func (*StructEncoder) IntPtr

func (e *StructEncoder) IntPtr(column string, v *int)

func (*StructEncoder) Ints

func (e *StructEncoder) Ints(column string, v []int)

func (*StructEncoder) New

func (e *StructEncoder) New() Encoder

func (*StructEncoder) String

func (e *StructEncoder) String(column string, v string)

func (*StructEncoder) StringPtr

func (e *StructEncoder) StringPtr(column string, v *string)

func (*StructEncoder) Strings

func (e *StructEncoder) Strings(column string, v []string)

func (*StructEncoder) Struct

func (e *StructEncoder) Struct(column string, v Marshaler)

func (*StructEncoder) Structs

func (e *StructEncoder) Structs(column string, v Marshaler)

func (*StructEncoder) Time

func (e *StructEncoder) Time(column string, v time.Time)

func (*StructEncoder) TimePtr

func (e *StructEncoder) TimePtr(column string, v *time.Time)

func (*StructEncoder) Times

func (e *StructEncoder) Times(column string, v []time.Time)

func (*StructEncoder) Uint

func (e *StructEncoder) Uint(column string, v uint)

func (*StructEncoder) Uint16

func (e *StructEncoder) Uint16(column string, v uint16)

func (*StructEncoder) Uint16Ptr

func (e *StructEncoder) Uint16Ptr(column string, v *uint16)

func (*StructEncoder) Uint16s

func (e *StructEncoder) Uint16s(column string, v []uint16)

func (*StructEncoder) Uint32

func (e *StructEncoder) Uint32(column string, v uint32)

func (*StructEncoder) Uint32Ptr

func (e *StructEncoder) Uint32Ptr(column string, v *uint32)

func (*StructEncoder) Uint32s

func (e *StructEncoder) Uint32s(column string, v []uint32)

func (*StructEncoder) Uint64

func (e *StructEncoder) Uint64(column string, v uint64)

func (*StructEncoder) Uint64Ptr

func (e *StructEncoder) Uint64Ptr(column string, v *uint64)

func (*StructEncoder) Uint64s

func (e *StructEncoder) Uint64s(column string, v []uint64)

func (*StructEncoder) Uint8

func (e *StructEncoder) Uint8(column string, v uint8)

func (*StructEncoder) Uint8Ptr

func (e *StructEncoder) Uint8Ptr(column string, v *uint8)

func (*StructEncoder) Uint8s

func (e *StructEncoder) Uint8s(column string, v []uint8)

func (*StructEncoder) UintPtr

func (e *StructEncoder) UintPtr(column string, v *uint)

func (*StructEncoder) Uints

func (e *StructEncoder) Uints(column string, v []uint)

type StructField

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

func (*StructField) ScanValue

func (sf *StructField) ScanValue(factory *ValueFactory) *Value

type StructSliceEncoder

type StructSliceEncoder struct {
	*StructEncoder
	// contains filtered or unexported fields
}

func NewStructSliceEncoder

func NewStructSliceEncoder(typ *Struct, valueFactory *ValueFactory, coder Coder) *StructSliceEncoder

func (*StructSliceEncoder) Encode

func (e *StructSliceEncoder) Encode() ([]byte, error)

type StructSliceValue

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

func NewStructSliceValue

func NewStructSliceValue() *StructSliceValue

func (*StructSliceValue) Append

func (v *StructSliceValue) Append(value *StructValue)

func (*StructSliceValue) AppendSlice

func (v *StructSliceValue) AppendSlice(slice *StructSliceValue)

func (*StructSliceValue) At

func (v *StructSliceValue) At(idx int) Decoder

func (*StructSliceValue) Bool

func (v *StructSliceValue) Bool(column string) bool

func (*StructSliceValue) BoolPtr

func (v *StructSliceValue) BoolPtr(column string) *bool

func (*StructSliceValue) Bools

func (v *StructSliceValue) Bools(column string) []bool

func (*StructSliceValue) Bytes

func (v *StructSliceValue) Bytes(column string) []byte

func (*StructSliceValue) BytesPtr

func (v *StructSliceValue) BytesPtr(column string) *[]byte

func (*StructSliceValue) EncodeLog

func (v *StructSliceValue) EncodeLog() string

func (*StructSliceValue) Error

func (v *StructSliceValue) Error() error

func (*StructSliceValue) Filter

func (v *StructSliceValue) Filter(condition Condition) *StructSliceValue

func (*StructSliceValue) Float32

func (v *StructSliceValue) Float32(column string) float32

func (*StructSliceValue) Float32Ptr

func (v *StructSliceValue) Float32Ptr(column string) *float32

func (*StructSliceValue) Float32s

func (v *StructSliceValue) Float32s(column string) []float32

func (*StructSliceValue) Float64

func (v *StructSliceValue) Float64(column string) float64

func (*StructSliceValue) Float64Ptr

func (v *StructSliceValue) Float64Ptr(column string) *float64

func (*StructSliceValue) Float64s

func (v *StructSliceValue) Float64s(column string) []float64

func (*StructSliceValue) Int

func (v *StructSliceValue) Int(column string) int

func (*StructSliceValue) Int16

func (v *StructSliceValue) Int16(column string) int16

func (*StructSliceValue) Int16Ptr

func (v *StructSliceValue) Int16Ptr(column string) *int16

func (*StructSliceValue) Int16s

func (v *StructSliceValue) Int16s(column string) []int16

func (*StructSliceValue) Int32

func (v *StructSliceValue) Int32(column string) int32

func (*StructSliceValue) Int32Ptr

func (v *StructSliceValue) Int32Ptr(column string) *int32

func (*StructSliceValue) Int32s

func (v *StructSliceValue) Int32s(column string) []int32

func (*StructSliceValue) Int64

func (v *StructSliceValue) Int64(column string) int64

func (*StructSliceValue) Int64Ptr

func (v *StructSliceValue) Int64Ptr(column string) *int64

func (*StructSliceValue) Int64s

func (v *StructSliceValue) Int64s(column string) []int64

func (*StructSliceValue) Int8

func (v *StructSliceValue) Int8(column string) int8

func (*StructSliceValue) Int8Ptr

func (v *StructSliceValue) Int8Ptr(column string) *int8

func (*StructSliceValue) Int8s

func (v *StructSliceValue) Int8s(column string) []int8

func (*StructSliceValue) IntPtr

func (v *StructSliceValue) IntPtr(column string) *int

func (*StructSliceValue) Ints

func (v *StructSliceValue) Ints(column string) []int

func (*StructSliceValue) Len

func (v *StructSliceValue) Len() int

func (*StructSliceValue) Release

func (v *StructSliceValue) Release()

func (*StructSliceValue) Slice

func (v *StructSliceValue) Slice(column string, unmarshaler Unmarshaler)

func (*StructSliceValue) Sort

func (v *StructSliceValue) Sort(orders []*OrderCondition)

func (*StructSliceValue) String

func (v *StructSliceValue) String(column string) string

func (*StructSliceValue) StringPtr

func (v *StructSliceValue) StringPtr(column string) *string

func (*StructSliceValue) Strings

func (v *StructSliceValue) Strings(column string) []string

func (*StructSliceValue) Struct

func (v *StructSliceValue) Struct(column string, unmarshaler Unmarshaler)

func (*StructSliceValue) Time

func (v *StructSliceValue) Time(column string) time.Time

func (*StructSliceValue) TimePtr

func (v *StructSliceValue) TimePtr(column string) *time.Time

func (*StructSliceValue) Times

func (v *StructSliceValue) Times(column string) []time.Time

func (*StructSliceValue) Uint

func (v *StructSliceValue) Uint(column string) uint

func (*StructSliceValue) Uint16

func (v *StructSliceValue) Uint16(column string) uint16

func (*StructSliceValue) Uint16Ptr

func (v *StructSliceValue) Uint16Ptr(column string) *uint16

func (*StructSliceValue) Uint16s

func (v *StructSliceValue) Uint16s(column string) []uint16

func (*StructSliceValue) Uint32

func (v *StructSliceValue) Uint32(column string) uint32

func (*StructSliceValue) Uint32Ptr

func (v *StructSliceValue) Uint32Ptr(column string) *uint32

func (*StructSliceValue) Uint32s

func (v *StructSliceValue) Uint32s(column string) []uint32

func (*StructSliceValue) Uint64

func (v *StructSliceValue) Uint64(column string) uint64

func (*StructSliceValue) Uint64Ptr

func (v *StructSliceValue) Uint64Ptr(column string) *uint64

func (*StructSliceValue) Uint64s

func (v *StructSliceValue) Uint64s(column string) []uint64

func (*StructSliceValue) Uint8

func (v *StructSliceValue) Uint8(column string) uint8

func (*StructSliceValue) Uint8Ptr

func (v *StructSliceValue) Uint8Ptr(column string) *uint8

func (*StructSliceValue) Uint8s

func (v *StructSliceValue) Uint8s(column string) []uint8

func (*StructSliceValue) UintPtr

func (v *StructSliceValue) UintPtr(column string) *uint

func (*StructSliceValue) Uints

func (v *StructSliceValue) Uints(column string) []uint

type StructValue

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

func (*StructValue) At

func (v *StructValue) At(int) Decoder

func (*StructValue) Bool

func (v *StructValue) Bool(column string) bool

func (*StructValue) BoolPtr

func (v *StructValue) BoolPtr(column string) *bool

func (*StructValue) Bools

func (v *StructValue) Bools(column string) []bool

func (*StructValue) Bytes

func (v *StructValue) Bytes(column string) []byte

func (*StructValue) BytesPtr

func (v *StructValue) BytesPtr(column string) *[]byte

func (*StructValue) EncodeLog

func (v *StructValue) EncodeLog() string

func (*StructValue) Error

func (v *StructValue) Error() error

func (*StructValue) Float32

func (v *StructValue) Float32(column string) float32

func (*StructValue) Float32Ptr

func (v *StructValue) Float32Ptr(column string) *float32

func (*StructValue) Float32s

func (v *StructValue) Float32s(column string) []float32

func (*StructValue) Float64

func (v *StructValue) Float64(column string) float64

func (*StructValue) Float64Ptr

func (v *StructValue) Float64Ptr(column string) *float64

func (*StructValue) Float64s

func (v *StructValue) Float64s(column string) []float64

func (*StructValue) Int

func (v *StructValue) Int(column string) int

func (*StructValue) Int16

func (v *StructValue) Int16(column string) int16

func (*StructValue) Int16Ptr

func (v *StructValue) Int16Ptr(column string) *int16

func (*StructValue) Int16s

func (v *StructValue) Int16s(column string) []int16

func (*StructValue) Int32

func (v *StructValue) Int32(column string) int32

func (*StructValue) Int32Ptr

func (v *StructValue) Int32Ptr(column string) *int32

func (*StructValue) Int32s

func (v *StructValue) Int32s(column string) []int32

func (*StructValue) Int64

func (v *StructValue) Int64(column string) int64

func (*StructValue) Int64Ptr

func (v *StructValue) Int64Ptr(column string) *int64

func (*StructValue) Int64s

func (v *StructValue) Int64s(column string) []int64

func (*StructValue) Int8

func (v *StructValue) Int8(column string) int8

func (*StructValue) Int8Ptr

func (v *StructValue) Int8Ptr(column string) *int8

func (*StructValue) Int8s

func (v *StructValue) Int8s(column string) []int8

func (*StructValue) IntPtr

func (v *StructValue) IntPtr(column string) *int

func (*StructValue) Ints

func (v *StructValue) Ints(column string) []int

func (*StructValue) Len

func (v *StructValue) Len() int

func (*StructValue) Release

func (v *StructValue) Release()

func (*StructValue) Slice

func (v *StructValue) Slice(column string, unmarshaler Unmarshaler)

func (*StructValue) String

func (v *StructValue) String(column string) string

func (*StructValue) StringPtr

func (v *StructValue) StringPtr(column string) *string

func (*StructValue) Strings

func (v *StructValue) Strings(column string) []string

func (*StructValue) Struct

func (v *StructValue) Struct(column string, unmarshaler Unmarshaler)

func (*StructValue) Time

func (v *StructValue) Time(column string) time.Time

func (*StructValue) TimePtr

func (v *StructValue) TimePtr(column string) *time.Time

func (*StructValue) Times

func (v *StructValue) Times(column string) []time.Time

func (*StructValue) Uint

func (v *StructValue) Uint(column string) uint

func (*StructValue) Uint16

func (v *StructValue) Uint16(column string) uint16

func (*StructValue) Uint16Ptr

func (v *StructValue) Uint16Ptr(column string) *uint16

func (*StructValue) Uint16s

func (v *StructValue) Uint16s(column string) []uint16

func (*StructValue) Uint32

func (v *StructValue) Uint32(column string) uint32

func (*StructValue) Uint32Ptr

func (v *StructValue) Uint32Ptr(column string) *uint32

func (*StructValue) Uint32s

func (v *StructValue) Uint32s(column string) []uint32

func (*StructValue) Uint64

func (v *StructValue) Uint64(column string) uint64

func (*StructValue) Uint64Ptr

func (v *StructValue) Uint64Ptr(column string) *uint64

func (*StructValue) Uint64s

func (v *StructValue) Uint64s(column string) []uint64

func (*StructValue) Uint8

func (v *StructValue) Uint8(column string) uint8

func (*StructValue) Uint8Ptr

func (v *StructValue) Uint8Ptr(column string) *uint8

func (*StructValue) Uint8s

func (v *StructValue) Uint8s(column string) []uint8

func (*StructValue) UintPtr

func (v *StructValue) UintPtr(column string) *uint

func (*StructValue) Uints

func (v *StructValue) Uints(column string) []uint

func (*StructValue) ValueByColumn

func (v *StructValue) ValueByColumn(column string) *Value

type StructsCoder

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

func Structs

func Structs(v Coder, typ *Struct) *StructsCoder

func StructsPtr

func StructsPtr(v Coder, typ *Struct) *StructsCoder

func (*StructsCoder) Decode

func (c *StructsCoder) Decode(content []byte) error

func (*StructsCoder) Encode

func (c *StructsCoder) Encode() ([]byte, error)

type TableConfig

type TableConfig struct {
	ShardKey       *string             `yaml:"shard_key"`
	Server         *string             `yaml:"server"`
	CacheControl   *CacheControlConfig `yaml:"cache_control"`
	Expiration     *time.Duration      `yaml:"expiration"`
	LockExpiration *time.Duration      `yaml:"lock_expiration"`
}

func (*TableConfig) Options

func (cfg *TableConfig) Options(table string) []OptionFunc

type TableOption

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

func (*TableOption) Expiration

func (o *TableOption) Expiration() time.Duration

func (*TableOption) LockExpiration

func (o *TableOption) LockExpiration() time.Duration

func (*TableOption) OptimisticLock

func (o *TableOption) OptimisticLock() bool

func (*TableOption) PessimisticLock

func (o *TableOption) PessimisticLock() bool

func (*TableOption) Server

func (o *TableOption) Server() string

func (*TableOption) ShardKey

func (o *TableOption) ShardKey() string

type TagConfig

type TagConfig struct {
	Server         *string             `yaml:"server"`
	CacheControl   *CacheControlConfig `yaml:"cache_control"`
	Expiration     *time.Duration      `yaml:"expiration"`
	LockExpiration *time.Duration      `yaml:"lock_expiration"`
}

func (*TagConfig) Options

func (cfg *TagConfig) Options(tag string) []OptionFunc

type TagOption

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

type TimeCoder

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

func Time

func Time(v time.Time) *TimeCoder

func TimePtr

func TimePtr(v *time.Time) *TimeCoder

func (*TimeCoder) Decode

func (c *TimeCoder) Decode(content []byte) error

func (*TimeCoder) Encode

func (c *TimeCoder) Encode() ([]byte, error)

type TimesCoder

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

func Times

func Times(v []time.Time) *TimesCoder

func TimesPtr

func TimesPtr(v *[]time.Time) *TimesCoder

func (*TimesCoder) Decode

func (c *TimesCoder) Decode(content []byte) error

func (*TimesCoder) Encode

func (c *TimesCoder) Encode() ([]byte, error)

type Tx

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

func (*Tx) AfterCommitCallback added in v0.0.9

func (tx *Tx) AfterCommitCallback(
	successCallback func() error,
	failureCallback func([]*QueryLog) error)

func (*Tx) BeforeCommitCallback added in v0.0.9

func (tx *Tx) BeforeCommitCallback(callback func([]*QueryLog) error)

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) CommitCacheOnly

func (tx *Tx) CommitCacheOnly() error

func (*Tx) CommitDBOnly

func (tx *Tx) CommitDBOnly() error

func (*Tx) CountByQueryBuilder

func (tx *Tx) CountByQueryBuilder(builder *QueryBuilder) (uint64, error)

func (*Tx) CountByQueryBuilderContext added in v0.0.7

func (tx *Tx) CountByQueryBuilderContext(ctx context.Context, builder *QueryBuilder) (uint64, error)

func (*Tx) Create

func (tx *Tx) Create(key string, value Type) error

func (*Tx) CreateByTable

func (tx *Tx) CreateByTable(tableName string, marshaler Marshaler) (int64, error)

func (*Tx) CreateByTableContext

func (tx *Tx) CreateByTableContext(ctx context.Context, tableName string, marshaler Marshaler) (id int64, e error)

func (*Tx) CreateWithExpiration

func (tx *Tx) CreateWithExpiration(key string, value Type, expiration time.Duration) error

func (*Tx) CreateWithTag

func (tx *Tx) CreateWithTag(tag, key string, value Type) error

func (*Tx) CreateWithTagAndExpiration

func (tx *Tx) CreateWithTagAndExpiration(tag, key string, value Type, expiration time.Duration) error

func (*Tx) Delete

func (tx *Tx) Delete(key string) error

func (*Tx) DeleteByQueryBuilder

func (tx *Tx) DeleteByQueryBuilder(builder *QueryBuilder) error

func (*Tx) DeleteByQueryBuilderContext

func (tx *Tx) DeleteByQueryBuilderContext(ctx context.Context, builder *QueryBuilder) error

func (*Tx) DeleteWithTag

func (tx *Tx) DeleteWithTag(tag, key string) error

func (*Tx) Find

func (tx *Tx) Find(key string, value Type) error

func (*Tx) FindAllByTable

func (tx *Tx) FindAllByTable(tableName string, unmarshaler Unmarshaler) error

func (*Tx) FindByQueryBuilder

func (tx *Tx) FindByQueryBuilder(builder *QueryBuilder, unmarshaler Unmarshaler) error

func (*Tx) FindByQueryBuilderContext

func (tx *Tx) FindByQueryBuilderContext(ctx context.Context, builder *QueryBuilder, unmarshaler Unmarshaler) error

func (*Tx) FindWithTag

func (tx *Tx) FindWithTag(tag, key string, value Type) error

func (*Tx) ID

func (tx *Tx) ID() string

func (*Tx) IsCommitted added in v0.0.6

func (tx *Tx) IsCommitted() bool

func (*Tx) Rollback

func (tx *Tx) Rollback() error

func (*Tx) RollbackCacheOnly

func (tx *Tx) RollbackCacheOnly() error

func (*Tx) RollbackCacheOnlyUnlessCommitted

func (tx *Tx) RollbackCacheOnlyUnlessCommitted() error

func (*Tx) RollbackDBOnly

func (tx *Tx) RollbackDBOnly() error

func (*Tx) RollbackDBOnlyUnlessCommitted

func (tx *Tx) RollbackDBOnlyUnlessCommitted() error

func (*Tx) RollbackUnlessCommitted

func (tx *Tx) RollbackUnlessCommitted() error

func (*Tx) Update

func (tx *Tx) Update(key string, value Type) error

func (*Tx) UpdateByQueryBuilder

func (tx *Tx) UpdateByQueryBuilder(builder *QueryBuilder, updateMap map[string]interface{}) error

func (*Tx) UpdateByQueryBuilderContext

func (tx *Tx) UpdateByQueryBuilderContext(ctx context.Context, builder *QueryBuilder, updateMap map[string]interface{}) error

func (*Tx) UpdateWithExpiration

func (tx *Tx) UpdateWithExpiration(key string, value Type, expiration time.Duration) error

func (*Tx) UpdateWithTag

func (tx *Tx) UpdateWithTag(tag, key string, value Type) error

func (*Tx) UpdateWithTagAndExpiration

func (tx *Tx) UpdateWithTagAndExpiration(tag, key string, value Type, expiration time.Duration) error

type TxConnection

type TxConnection interface {
	Connection
	Commit() error
	Rollback() error
}

type TxValue

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

func (*TxValue) EncodeLog

func (v *TxValue) EncodeLog() string

func (*TxValue) Marshal

func (v *TxValue) Marshal() ([]byte, error)

func (*TxValue) String

func (v *TxValue) String() string

func (*TxValue) Unmarshal

func (v *TxValue) Unmarshal(content []byte) error

type Type

type Type interface {
	Encode() ([]byte, error)
	Decode([]byte) error
}

type TypeID

type TypeID int
const (
	IntType TypeID = iota
	Int8Type
	Int16Type
	Int32Type
	Int64Type
	UintType
	Uint8Type
	Uint16Type
	Uint32Type
	Uint64Type
	Float32Type
	Float64Type
	BoolType
	StringType
	BytesType
	TimeType
	SliceType
	StructType
)

func (TypeID) String

func (t TypeID) String() string

type TypeKind

type TypeKind int
const (
	IntKind TypeKind = iota
	FloatKind
	BoolKind
	StringKind
	BytesKind
	TimeKind
)

func (TypeKind) String

func (t TypeKind) String() string

type Uint16Coder

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

func Uint16

func Uint16(v uint16) *Uint16Coder

func Uint16Ptr

func Uint16Ptr(v *uint16) *Uint16Coder

func (*Uint16Coder) Decode

func (c *Uint16Coder) Decode(content []byte) error

func (*Uint16Coder) Encode

func (c *Uint16Coder) Encode() ([]byte, error)

type Uint16sCoder

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

func Uint16s

func Uint16s(v []uint16) *Uint16sCoder

func Uint16sPtr

func Uint16sPtr(v *[]uint16) *Uint16sCoder

func (*Uint16sCoder) Decode

func (c *Uint16sCoder) Decode(content []byte) error

func (*Uint16sCoder) Encode

func (c *Uint16sCoder) Encode() ([]byte, error)

type Uint32Coder

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

func Uint32

func Uint32(v uint32) *Uint32Coder

func Uint32Ptr

func Uint32Ptr(v *uint32) *Uint32Coder

func (*Uint32Coder) Decode

func (c *Uint32Coder) Decode(content []byte) error

func (*Uint32Coder) Encode

func (c *Uint32Coder) Encode() ([]byte, error)

type Uint32sCoder

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

func Uint32s

func Uint32s(v []uint32) *Uint32sCoder

func Uint32sPtr

func Uint32sPtr(v *[]uint32) *Uint32sCoder

func (*Uint32sCoder) Decode

func (c *Uint32sCoder) Decode(content []byte) error

func (*Uint32sCoder) Encode

func (c *Uint32sCoder) Encode() ([]byte, error)

type Uint64Coder

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

func Uint64

func Uint64(v uint64) *Uint64Coder

func Uint64Ptr

func Uint64Ptr(v *uint64) *Uint64Coder

func (*Uint64Coder) Decode

func (c *Uint64Coder) Decode(content []byte) error

func (*Uint64Coder) Encode

func (c *Uint64Coder) Encode() ([]byte, error)

type Uint64sCoder

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

func Uint64s

func Uint64s(v []uint64) *Uint64sCoder

func Uint64sPtr

func Uint64sPtr(v *[]uint64) *Uint64sCoder

func (*Uint64sCoder) Decode

func (c *Uint64sCoder) Decode(content []byte) error

func (*Uint64sCoder) Encode

func (c *Uint64sCoder) Encode() ([]byte, error)

type Uint8Coder

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

func Uint8

func Uint8(v uint8) *Uint8Coder

func Uint8Ptr

func Uint8Ptr(v *uint8) *Uint8Coder

func (*Uint8Coder) Decode

func (c *Uint8Coder) Decode(content []byte) error

func (*Uint8Coder) Encode

func (c *Uint8Coder) Encode() ([]byte, error)

type Uint8sCoder

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

func Uint8s

func Uint8s(v []uint8) *Uint8sCoder

func Uint8sPtr

func Uint8sPtr(v *[]uint8) *Uint8sCoder

func (*Uint8sCoder) Decode

func (c *Uint8sCoder) Decode(content []byte) error

func (*Uint8sCoder) Encode

func (c *Uint8sCoder) Encode() ([]byte, error)

type UintCoder

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

func Uint

func Uint(v uint) *UintCoder

func UintPtr

func UintPtr(v *uint) *UintCoder

func (*UintCoder) Decode

func (c *UintCoder) Decode(content []byte) error

func (*UintCoder) Encode

func (c *UintCoder) Encode() ([]byte, error)

type UintsCoder

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

func Uints

func Uints(v []uint) *UintsCoder

func UintsPtr

func UintsPtr(v *[]uint) *UintsCoder

func (*UintsCoder) Decode

func (c *UintsCoder) Decode(content []byte) error

func (*UintsCoder) Encode

func (c *UintsCoder) Encode() ([]byte, error)

type Unmarshaler

type Unmarshaler interface {
	DecodeRapidash(Decoder) error
}

type Value

type Value struct {
	IsNil bool
	Set   func(interface{})
	EQ    func(*Value) bool
	NEQ   func(*Value) bool
	LT    func(*Value) bool
	LTE   func(*Value) bool
	GT    func(*Value) bool
	GTE   func(*Value) bool

	String   func() string
	Hash     func() uint32
	RawValue func() interface{}
	// contains filtered or unexported fields
}

func NewBoolValue

func NewBoolValue(v bool) *Value

func NewBytesValue

func NewBytesValue(v []byte) *Value

func NewFloat32Value

func NewFloat32Value(v float32) *Value

func NewFloat64Value

func NewFloat64Value(v float64) *Value

func NewInt16Value

func NewInt16Value(v int16) *Value

func NewInt32Value

func NewInt32Value(v int32) *Value

func NewInt64Value

func NewInt64Value(v int64) *Value

func NewInt8Value

func NewInt8Value(v int8) *Value

func NewIntValue

func NewIntValue(v int) *Value

func NewNilValue

func NewNilValue() *Value

func NewStringValue

func NewStringValue(v string) *Value

func NewTimeValue

func NewTimeValue(v time.Time) *Value

func NewUint16Value

func NewUint16Value(v uint16) *Value

func NewUint32Value

func NewUint32Value(v uint32) *Value

func NewUint64Value

func NewUint64Value(v uint64) *Value

func NewUint8Value

func NewUint8Value(v uint8) *Value

func NewUintValue

func NewUintValue(v uint) *Value

func StructSliceValueToValue

func StructSliceValueToValue(v *StructSliceValue) *Value

func StructValueToValue

func StructValueToValue(v *StructValue) *Value

func ValuesToValue

func ValuesToValue(v []*Value) *Value

func (*Value) Release

func (v *Value) Release()

func (*Value) Scan

func (v *Value) Scan(src interface{}) error

type ValueDecoder

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

func NewDecoder

func NewDecoder(s *Struct, buf *bytes.Buffer, valueFactory *ValueFactory) *ValueDecoder

func (*ValueDecoder) Decode

func (d *ValueDecoder) Decode() (*StructValue, error)

func (*ValueDecoder) DecodeSlice

func (d *ValueDecoder) DecodeSlice() (*StructSliceValue, error)

func (*ValueDecoder) SetBuffer

func (d *ValueDecoder) SetBuffer(content []byte)

type ValueFactory

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

func NewValueFactory

func NewValueFactory() *ValueFactory

func (*ValueFactory) CreateBoolPtrValue

func (f *ValueFactory) CreateBoolPtrValue(v *bool) *Value

func (*ValueFactory) CreateBoolValue

func (f *ValueFactory) CreateBoolValue(v bool) *Value

func (*ValueFactory) CreateBytesPtrValue

func (f *ValueFactory) CreateBytesPtrValue(v *[]byte) *Value

func (*ValueFactory) CreateBytesValue

func (f *ValueFactory) CreateBytesValue(v []byte) *Value

func (*ValueFactory) CreateDefaultValue

func (f *ValueFactory) CreateDefaultValue(typ TypeID) *Value

func (*ValueFactory) CreateFloat32PtrValue

func (f *ValueFactory) CreateFloat32PtrValue(v *float32) *Value

func (*ValueFactory) CreateFloat32Value

func (f *ValueFactory) CreateFloat32Value(v float32) *Value

func (*ValueFactory) CreateFloat64PtrValue

func (f *ValueFactory) CreateFloat64PtrValue(v *float64) *Value

func (*ValueFactory) CreateFloat64Value

func (f *ValueFactory) CreateFloat64Value(v float64) *Value

func (*ValueFactory) CreateInt16PtrValue

func (f *ValueFactory) CreateInt16PtrValue(v *int16) *Value

func (*ValueFactory) CreateInt16Value

func (f *ValueFactory) CreateInt16Value(v int16) *Value

func (*ValueFactory) CreateInt32PtrValue

func (f *ValueFactory) CreateInt32PtrValue(v *int32) *Value

func (*ValueFactory) CreateInt32Value

func (f *ValueFactory) CreateInt32Value(v int32) *Value

func (*ValueFactory) CreateInt64PtrValue

func (f *ValueFactory) CreateInt64PtrValue(v *int64) *Value

func (*ValueFactory) CreateInt64Value

func (f *ValueFactory) CreateInt64Value(v int64) *Value

func (*ValueFactory) CreateInt8PtrValue

func (f *ValueFactory) CreateInt8PtrValue(v *int8) *Value

func (*ValueFactory) CreateInt8Value

func (f *ValueFactory) CreateInt8Value(v int8) *Value

func (*ValueFactory) CreateIntPtrValue

func (f *ValueFactory) CreateIntPtrValue(v *int) *Value

func (*ValueFactory) CreateIntValue

func (f *ValueFactory) CreateIntValue(v int) *Value

func (*ValueFactory) CreateStringPtrValue

func (f *ValueFactory) CreateStringPtrValue(v *string) *Value

func (*ValueFactory) CreateStringValue

func (f *ValueFactory) CreateStringValue(v string) *Value

func (*ValueFactory) CreateTimePtrValue

func (f *ValueFactory) CreateTimePtrValue(v *time.Time) *Value

func (*ValueFactory) CreateTimeValue

func (f *ValueFactory) CreateTimeValue(v time.Time) *Value

func (*ValueFactory) CreateUint16PtrValue

func (f *ValueFactory) CreateUint16PtrValue(v *uint16) *Value

func (*ValueFactory) CreateUint16Value

func (f *ValueFactory) CreateUint16Value(v uint16) *Value

func (*ValueFactory) CreateUint32PtrValue

func (f *ValueFactory) CreateUint32PtrValue(v *uint32) *Value

func (*ValueFactory) CreateUint32Value

func (f *ValueFactory) CreateUint32Value(v uint32) *Value

func (*ValueFactory) CreateUint64PtrValue

func (f *ValueFactory) CreateUint64PtrValue(v *uint64) *Value

func (*ValueFactory) CreateUint64Value

func (f *ValueFactory) CreateUint64Value(v uint64) *Value

func (*ValueFactory) CreateUint8PtrValue

func (f *ValueFactory) CreateUint8PtrValue(v *uint8) *Value

func (*ValueFactory) CreateUint8Value

func (f *ValueFactory) CreateUint8Value(v uint8) *Value

func (*ValueFactory) CreateUintPtrValue

func (f *ValueFactory) CreateUintPtrValue(v *uint) *Value

func (*ValueFactory) CreateUintValue

func (f *ValueFactory) CreateUintValue(v uint) *Value

func (*ValueFactory) CreateUniqueValues added in v0.0.6

func (f *ValueFactory) CreateUniqueValues(v interface{}) []*Value

func (*ValueFactory) CreateValue

func (f *ValueFactory) CreateValue(v interface{}) *Value

func (*ValueFactory) CreateValueFromString

func (f *ValueFactory) CreateValueFromString(v string, typeID TypeID) (*Value, error)

type ValueIterator

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

func NewValueIterator

func NewValueIterator(keys []server.CacheKey) *ValueIterator

func (*ValueIterator) Error

func (i *ValueIterator) Error() error

func (*ValueIterator) Next

func (i *ValueIterator) Next() bool

func (*ValueIterator) PrimaryKey

func (i *ValueIterator) PrimaryKey() server.CacheKey

func (*ValueIterator) QueryByPrimaryKey

func (i *ValueIterator) QueryByPrimaryKey(factory *ValueFactory, primaryIndex *Index) (*Query, error)

func (*ValueIterator) Reset

func (i *ValueIterator) Reset()

func (*ValueIterator) SetError

func (i *ValueIterator) SetError(err error)

func (*ValueIterator) SetErrorWithKey

func (i *ValueIterator) SetErrorWithKey(key server.CacheKey, err error)

func (*ValueIterator) SetValue

func (i *ValueIterator) SetValue(value *StructValue)

func (*ValueIterator) SetValueWithKey

func (i *ValueIterator) SetValueWithKey(key server.CacheKey, value *StructValue)

func (*ValueIterator) Value

func (i *ValueIterator) Value() *StructValue

type Values

type Values []*Value

func (Values) At

func (v Values) At(idx int) Decoder

func (Values) Bool

func (Values) Bool(string) bool

func (Values) BoolPtr

func (Values) BoolPtr(string) *bool

func (Values) Bools

func (Values) Bools(string) []bool

func (Values) Bytes

func (Values) Bytes(string) []byte

func (Values) BytesPtr

func (Values) BytesPtr(string) *[]byte

func (Values) Error

func (Values) Error() error

func (Values) Float32

func (Values) Float32(string) float32

func (Values) Float32Ptr

func (Values) Float32Ptr(string) *float32

func (Values) Float32s

func (Values) Float32s(string) []float32

func (Values) Float64

func (Values) Float64(string) float64

func (Values) Float64Ptr

func (Values) Float64Ptr(string) *float64

func (Values) Float64s

func (Values) Float64s(string) []float64

func (Values) Int

func (Values) Int(string) int

func (Values) Int16

func (Values) Int16(string) int16

func (Values) Int16Ptr

func (Values) Int16Ptr(string) *int16

func (Values) Int16s

func (Values) Int16s(string) []int16

func (Values) Int32

func (Values) Int32(string) int32

func (Values) Int32Ptr

func (Values) Int32Ptr(string) *int32

func (Values) Int32s

func (Values) Int32s(string) []int32

func (Values) Int64

func (Values) Int64(string) int64

func (Values) Int64Ptr

func (Values) Int64Ptr(string) *int64

func (Values) Int64s

func (Values) Int64s(string) []int64

func (Values) Int8

func (Values) Int8(string) int8

func (Values) Int8Ptr

func (Values) Int8Ptr(string) *int8

func (Values) Int8s

func (Values) Int8s(string) []int8

func (Values) IntPtr

func (Values) IntPtr(string) *int

func (Values) Ints

func (Values) Ints(string) []int

func (Values) Len

func (v Values) Len() int

func (Values) Slice

func (Values) Slice(string, Unmarshaler)

func (Values) String

func (Values) String(string) string

func (Values) StringPtr

func (Values) StringPtr(string) *string

func (Values) Strings

func (Values) Strings(string) []string

func (Values) Struct

func (Values) Struct(string, Unmarshaler)

func (Values) Time

func (Values) Time(string) time.Time

func (Values) TimePtr

func (Values) TimePtr(string) *time.Time

func (Values) Times

func (Values) Times(string) []time.Time

func (Values) Uint

func (Values) Uint(string) uint

func (Values) Uint16

func (Values) Uint16(string) uint16

func (Values) Uint16Ptr

func (Values) Uint16Ptr(string) *uint16

func (Values) Uint16s

func (Values) Uint16s(string) []uint16

func (Values) Uint32

func (Values) Uint32(string) uint32

func (Values) Uint32Ptr

func (Values) Uint32Ptr(string) *uint32

func (Values) Uint32s

func (Values) Uint32s(string) []uint32

func (Values) Uint64

func (Values) Uint64(string) uint64

func (Values) Uint64Ptr

func (Values) Uint64Ptr(string) *uint64

func (Values) Uint64s

func (Values) Uint64s(string) []uint64

func (Values) Uint8

func (Values) Uint8(string) uint8

func (Values) Uint8Ptr

func (Values) Uint8Ptr(string) *uint8

func (Values) Uint8s

func (Values) Uint8s(string) []uint8

func (Values) UintPtr

func (Values) UintPtr(string) *uint

func (Values) Uints

func (Values) Uints(string) []uint

Directories

Path Synopsis
cmd
static
statik

Jump to

Keyboard shortcuts

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