Help us shape the future of Go! Take the 2026 Go Developer Survey

cache

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TypeReadMulti  = "warmup"
	TypeReadSingle = "lazy"
	TypeWrite      = "write"
	TypeNone       = "none"

	ErrorNone                      = ""
	ErrorTypeTimeout               = "aerospike timeout error"
	ErrorTypeServerUnavailable     = "aerospike server unavailable node"
	ErrorTypeServerGeneric         = "aerospike error occured"
	ErrorTypeCurrentlyNotAvailable = "aerospike currently not available"
)

Variables

View Source
var Now = time.Now

Functions

func ReadLine

func ReadLine(reader LineReader) ([]byte, error)

Types

type AllowSmart

type AllowSmart bool

type Cache

type Cache interface {
	AsSource(ctx context.Context, entry *Entry) (Source, error)
	AddValues(ctx context.Context, entry *Entry, values []interface{}) error
	Get(ctx context.Context, sql string, args []interface{}, options ...interface{}) (*Entry, error)
	AssignRows(entry *Entry, rows *sql.Rows) error
	UpdateType(ctx context.Context, entry *Entry, args []interface{}) (bool, error)
	Close(ctx context.Context, entry *Entry) error
	Delete(todo context.Context, entry *Entry) error
	Rollback(ctx context.Context, entry *Entry) error
	IndexBy(ctx context.Context, db *sql.DB, column, SQL string, args []interface{}) (int, error)
}

type ColumnsHolder

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

func NewColumnsHolder

func NewColumnsHolder(entry *Entry) *ColumnsHolder

func (*ColumnsHolder) ConvertColumns

func (s *ColumnsHolder) ConvertColumns() ([]io.Column, error)

type Decoder

type Decoder struct {
	Data []byte
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(scanTypes []reflect.Type, data []byte) *Decoder

func (*Decoder) UnmarshalJSONArray

func (d *Decoder) UnmarshalJSONArray(decoder *gojay.Decoder) error

type DecoderFn

type DecoderFn func(decoder *gojay.Decoder) (interface{}, error)

type Entry

type Entry struct {
	Meta        Meta
	Data        []byte // Entry is used as Iterator, Data is last streamed line.
	Id          string
	WriteCloser *WriteCloser
	ReadCloser  *ReadCloser
	Refresh     bool

	RowAdded bool
	// contains filtered or unexported fields
}

func (*Entry) AssignRows

func (e *Entry) AssignRows(rows *sql.Rows) error

func (*Entry) Close

func (e *Entry) Close() error

func (*Entry) Has

func (e *Entry) Has() bool

func (*Entry) Next

func (e *Entry) Next() bool

func (*Entry) SetReader

func (e *Entry) SetReader(reader Reader, closer goIo.Closer)

func (*Entry) SetWriter

func (e *Entry) SetWriter(writer Writer, closer goIo.Closer)

func (*Entry) Write

func (e *Entry) Write(data []byte) error

type ErrorType added in v0.2.0

type ErrorType string

type Field

type Field struct {
	ColumnName      string
	ColumnLength    int64
	ColumnPrecision int64
	ColumnScale     int64
	ColumnScanType  string

	ColumnNullable     bool
	ColumnDatabaseName string
	ColumnTag          *io.Tag
	// contains filtered or unexported fields
}

func ColumnsToFields

func ColumnsToFields(ioColumns []io.Column) ([]*Field, error)

func (*Field) DatabaseTypeName

func (f *Field) DatabaseTypeName() string

func (*Field) DecimalSize

func (f *Field) DecimalSize() (precision, scale int64, ok bool)

func (*Field) Init

func (f *Field) Init() error

func (*Field) Length

func (f *Field) Length() (length int64, ok bool)

func (*Field) Name

func (f *Field) Name() string

func (*Field) Nullable

func (f *Field) Nullable() (nullable, ok bool)

func (*Field) ScanType

func (f *Field) ScanType() reflect.Type

func (*Field) Tag

func (f *Field) Tag() *io.Tag

type Indexed

type Indexed struct {
	ColumnValue interface{}
	Data        *bytes.Buffer
	Column      string
}

func NewIndexed

func NewIndexed(columnValue interface{}) *Indexed

func (*Indexed) StringifyData

func (i *Indexed) StringifyData(data []interface{}) error

type LineReader

type LineReader interface {
	ReadLine() (line []byte, prefix bool, err error)
}

type LineWriter

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

func (*LineWriter) Flush

func (l *LineWriter) Flush() error

func (*LineWriter) Write

func (l *LineWriter) Write(p []byte) (n int, err error)

type Meta

type Meta struct {
	SQL          string
	Args         []byte
	Type         []string
	Signature    string
	ExpiryTimeMs int
	Fields       []*Field

	URL string `json:"-" yaml:"-"`
}

type ParmetrizedQuery added in v0.2.0

type ParmetrizedQuery struct {
	By      string
	SQL     string
	Ordered bool //SQL uses order by indexby column
	Args    []interface{}
	In      []interface{}
	Offset  int
	Limit   int
	OnSkip  func(values []interface{}) error
	// contains filtered or unexported fields
}

ParmetrizedQuery abstraction to represent data optimisation with caching and custom pagination

func (*ParmetrizedQuery) Init added in v0.2.0

func (m *ParmetrizedQuery) Init()

func (*ParmetrizedQuery) MarshalArgs added in v0.2.0

func (m *ParmetrizedQuery) MarshalArgs() ([]byte, error)

type ReadCloser

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

func NewReadCloser

func NewReadCloser(reader Reader, closer io.Closer) *ReadCloser

func (*ReadCloser) Close

func (w *ReadCloser) Close() error

func (*ReadCloser) Read

func (w *ReadCloser) Read(p []byte) (n int, err error)

func (*ReadCloser) ReadLine

func (w *ReadCloser) ReadLine() (line []byte, prefix bool, err error)

type Reader

type Reader interface {
	io.Reader
	LineReader
}

type Recorder

type Recorder interface {
	AddValues(values []interface{})
	ScanValues(values []interface{})
}

type Refresh added in v0.9.1

type Refresh bool

Refresh forecase cache refresh

type ScanTypeHolder

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

func (*ScanTypeHolder) InitType

func (t *ScanTypeHolder) InitType(values []interface{})

func (*ScanTypeHolder) Match

func (t *ScanTypeHolder) Match(entry *Entry) bool

type Scanner

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

func NewScanner

func NewScanner(typeHolder *ScanTypeHolder, recorder Recorder) *Scanner

func (*Scanner) New

func (c *Scanner) New(e *Entry) ScannerFn

type ScannerFn

type ScannerFn func(args ...interface{}) error

type Source

type Source interface {
	ConvertColumns() ([]io.Column, error)
	Scanner(context.Context) ScannerFn
	XTypes() []*xunsafe.Type
	CheckType(ctx context.Context, values []interface{}) (bool, error)
	Close(ctx context.Context) error
	Next() bool
	Rollback(ctx context.Context) error
	Err() error
}

type Stats added in v0.2.0

type Stats struct {
	Type           Type
	RecordsCounter int
	Key            string
	Dataset        string
	Namespace      string
	FoundWarmup    bool             `json:",omitempty"`
	FoundLazy      bool             `json:",omitempty"`
	ErrorType      string           `json:",omitempty"`
	ErrorCode      types.ResultCode `json:",omitempty"`
	ExpiryTime     *time.Time
}

func (*Stats) FoundAny added in v0.2.0

func (s *Stats) FoundAny() bool

func (*Stats) Init added in v0.2.0

func (s *Stats) Init()

type Type added in v0.2.0

type Type string

type WriteCloser

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

func NewWriteCloser

func NewWriteCloser(writer Writer, closer io.Closer) *WriteCloser

func (*WriteCloser) Close

func (w *WriteCloser) Close() error

func (*WriteCloser) Flush

func (w *WriteCloser) Flush() error

func (*WriteCloser) Write

func (w *WriteCloser) Write(p []byte) (n int, err error)

type Writer

type Writer interface {
	io.Writer
	Flush() error
}

func NewLineWriter

func NewLineWriter(writer Writer) Writer

type XTypesHolder

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

func NewXTypeHolder

func NewXTypeHolder(entry *Entry) *XTypesHolder

func (*XTypesHolder) XTypes

func (s *XTypesHolder) XTypes() []*xunsafe.Type

Directories

Path Synopsis
ast

Jump to

Keyboard shortcuts

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