redis

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 13 Imported by: 0

README

redis

redis client for golang

Example
package main

import (
	"context"
	"fmt"

	"github.com/eatmoreapple/redis"
)

func main() {
	ctx := context.Background()

	client := redis.NewClient(ctx)
	defer client.Close()

	if err := client.Ping(ctx).Err(); err != nil {
		fmt.Println(err)
	} else {
		fmt.Println("ping ok")
	}
}

Documentation

Index

Constants

View Source
const (
	ErrorReply  = '-'
	StatusReply = '+'
	IntReply    = ':'
	StringReply = '$'
	ArrayReply  = '*'
)

Variables

View Source
var (
	// ErrInvalidReply is returned when the reply is not valid.
	ErrInvalidReply = errors.New("invalid reply type")

	// ErrLineTooLong is returned when the reply line is too long.
	ErrLineTooLong = errors.New("line too long")

	// ErrNil indicates that a reply value is nil.
	ErrNil = errors.New("nil returned")

	// ErrBadConn indicates that the netConn is bad.
	ErrBadConn = errors.New("bad netConn")

	// ErrPoolTimeout indicates that the pool is timeout.
	ErrPoolTimeout = errors.New("pool timeout")
)

Functions

This section is empty.

Types

type Args added in v1.0.0

type Args []any

Args defines a list of arguments for a command.

func AppendArg added in v1.0.0

func AppendArg[T any](dst Args, args ...T) Args

func (Args) AddFlat added in v1.0.0

func (a Args) AddFlat(keys []string) Args

type ArgsBuilder added in v1.0.0

type ArgsBuilder struct {
	*bytes.Buffer
}

ArgsBuilder is a builder for Args.

func (*ArgsBuilder) Build added in v1.0.0

func (s *ArgsBuilder) Build(ctx context.Context, args Args) error

Build builds args with resp protocol.

func (*ArgsBuilder) WriteArgs added in v1.0.0

func (s *ArgsBuilder) WriteArgs(args Args) error

WriteArgs writes args with resp protocol.

type BoolResult

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

func (BoolResult) Bool

func (b BoolResult) Bool() bool

func (BoolResult) Err added in v1.0.0

func (b BoolResult) Err() error

func (BoolResult) Result added in v1.0.0

func (b BoolResult) Result() (bool, error)

func (BoolResult) String added in v1.0.0

func (b BoolResult) String() string

type Client

type Client struct {
	Dialer func(ctx context.Context) (net.Conn, error)
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, opts ...OptionFunc) *Client

func NewClientWithOption added in v1.0.0

func NewClientWithOption(ctx context.Context, opt Options) *Client

func (*Client) Append added in v1.0.0

func (c *Client) Append(ctx context.Context, key string, value any) *IntResult

func (*Client) Auth added in v1.0.0

func (c *Client) Auth(ctx context.Context, password string) *BoolResult

func (*Client) BLPop added in v1.0.0

func (c *Client) BLPop(ctx context.Context, keys []string, timeout time.Duration) *KeyValueResult

func (*Client) BRPop added in v1.0.0

func (c *Client) BRPop(ctx context.Context, keys []string, timeout time.Duration) *KeyValueResult

func (*Client) BRPopLPush added in v1.0.0

func (c *Client) BRPopLPush(ctx context.Context, source string, destination string, timeout int) *StringResult

func (*Client) BitCount added in v1.0.0

func (c *Client) BitCount(ctx context.Context, key string, startAndEnd ...int64) *IntResult

func (*Client) Call added in v1.0.0

func (c *Client) Call(ctx context.Context, args Args, parser Parser) error

func (*Client) Close

func (c *Client) Close()

func (*Client) Decr added in v1.0.0

func (c *Client) Decr(ctx context.Context, key string) *IntResult

func (*Client) DecrBy added in v1.0.0

func (c *Client) DecrBy(ctx context.Context, key string, decrement int64) *IntResult

func (*Client) Del added in v1.0.0

func (c *Client) Del(ctx context.Context, keys ...string) *IntResult

func (*Client) DelCtx added in v1.0.0

func (c *Client) DelCtx(ctx context.Context, keys ...string) *IntResult

func (*Client) Dump added in v1.0.0

func (c *Client) Dump(ctx context.Context, key string) *StringResult

func (*Client) Echo added in v1.0.0

func (c *Client) Echo(ctx context.Context, message string) *StringResult

func (*Client) Exists added in v1.0.0

func (c *Client) Exists(ctx context.Context, keys ...string) *IntResult

func (*Client) ExistsCtx added in v1.0.0

func (c *Client) ExistsCtx(ctx context.Context, keys ...string) *IntResult

func (*Client) Expire added in v1.0.0

func (c *Client) Expire(ctx context.Context, key string, expiration time.Duration) *BoolResult

func (*Client) ExpireAt added in v1.0.0

func (c *Client) ExpireAt(ctx context.Context, key string, tm time.Time) *BoolResult

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string) *StringResult

func (*Client) GetBit added in v1.0.0

func (c *Client) GetBit(ctx context.Context, key string, offset int) *IntResult

func (*Client) GetRange added in v1.0.0

func (c *Client) GetRange(ctx context.Context, key string, start, end int) *StringResult

func (*Client) GetSet added in v1.0.0

func (c *Client) GetSet(ctx context.Context, key string, value any) *StringResult

func (*Client) HDel added in v1.0.0

func (c *Client) HDel(ctx context.Context, key string, fields ...string) *IntResult

func (*Client) HExists added in v1.0.0

func (c *Client) HExists(ctx context.Context, key string, field string) *BoolResult

func (*Client) HGet added in v1.0.0

func (c *Client) HGet(ctx context.Context, key string, field string) *StringResult

func (*Client) HGetAll added in v1.0.0

func (c *Client) HGetAll(ctx context.Context, key string) *StringMapResult

func (*Client) HGetAllMap added in v1.0.0

func (c *Client) HGetAllMap(ctx context.Context, key string) *StringMapResult

func (*Client) HGetMulti added in v1.0.0

func (c *Client) HGetMulti(ctx context.Context, key string, fields ...string) *StringMapResult

func (*Client) HIncrBy added in v1.0.0

func (c *Client) HIncrBy(ctx context.Context, key string, field string, increment int) *IntResult

func (*Client) HIncrByFloat added in v1.0.0

func (c *Client) HIncrByFloat(ctx context.Context, key string, field string, increment float64) *FloatResult

func (*Client) HKeys added in v1.0.0

func (c *Client) HKeys(ctx context.Context, key string) *StringSliceResult

func (*Client) HLen added in v1.0.0

func (c *Client) HLen(ctx context.Context, key string) *IntResult

func (*Client) HMGet added in v1.0.0

func (c *Client) HMGet(ctx context.Context, key string, fields ...string) *StringSliceResult

func (*Client) HMSet added in v1.0.0

func (c *Client) HMSet(ctx context.Context, key string, values map[string]string) *BoolResult

func (*Client) HScan added in v1.0.0

func (c *Client) HScan(ctx context.Context, key string, cursor int, match string, count int) *ScanResult

func (*Client) HSet added in v1.0.0

func (c *Client) HSet(ctx context.Context, key string, field string, value any) *BoolResult

func (*Client) HSetMulti added in v1.0.0

func (c *Client) HSetMulti(ctx context.Context, key string, values map[string]string) *BoolResult

func (*Client) HSetNX added in v1.0.0

func (c *Client) HSetNX(ctx context.Context, key string, field string, value any) *BoolResult

func (*Client) HStrLen added in v1.0.0

func (c *Client) HStrLen(ctx context.Context, key string, field string) *IntResult

func (*Client) HVals added in v1.0.0

func (c *Client) HVals(ctx context.Context, key string) *StringSliceResult

func (*Client) Incr added in v1.0.0

func (c *Client) Incr(ctx context.Context, key string) *IntResult

func (*Client) IncrBy added in v1.0.0

func (c *Client) IncrBy(ctx context.Context, key string, increment int64) *IntResult

func (*Client) IncrByFloat added in v1.0.0

func (c *Client) IncrByFloat(ctx context.Context, key string, increment float64) *FloatResult

func (*Client) Keys added in v1.0.0

func (c *Client) Keys(ctx context.Context, pattern string) *StringSliceResult

func (*Client) LIndex added in v1.0.0

func (c *Client) LIndex(ctx context.Context, key string, index int) *StringResult

func (*Client) LInsert added in v1.0.0

func (c *Client) LInsert(ctx context.Context, key string, pivot any, value any) *IntResult

func (*Client) LInsertAfter added in v1.0.0

func (c *Client) LInsertAfter(ctx context.Context, key string, pivot any, value any) *IntResult

func (*Client) LInsertBefore added in v1.0.0

func (c *Client) LInsertBefore(ctx context.Context, key string, pivot any, value any) *IntResult

func (*Client) LLen added in v1.0.0

func (c *Client) LLen(ctx context.Context, key string) *IntResult

func (*Client) LPop added in v1.0.0

func (c *Client) LPop(ctx context.Context, key string) *StringResult

func (*Client) LPush added in v1.0.0

func (c *Client) LPush(ctx context.Context, key string, values ...any) *IntResult

func (*Client) LPushX added in v1.0.0

func (c *Client) LPushX(ctx context.Context, key string, values ...any) *IntResult

func (*Client) LRange added in v1.0.0

func (c *Client) LRange(ctx context.Context, key string, start, stop int) *StringSliceResult

func (*Client) LRem added in v1.0.0

func (c *Client) LRem(ctx context.Context, key string, count int, value any) *IntResult

func (*Client) LSet added in v1.0.0

func (c *Client) LSet(ctx context.Context, key string, index int, value any) *BoolResult

func (*Client) LTrim added in v1.0.0

func (c *Client) LTrim(ctx context.Context, key string, start, stop int) *BoolResult

func (*Client) MGet added in v1.0.0

func (c *Client) MGet(ctx context.Context, key string, keys ...string) *StringSliceResult

func (*Client) MSet added in v1.0.0

func (c *Client) MSet(ctx context.Context, key string, value any, keysValues ...any) *BoolResult

func (*Client) MSetNX added in v1.0.0

func (c *Client) MSetNX(ctx context.Context, key string, value any, keysValues ...any) *BoolResult

func (*Client) Migrate added in v1.0.0

func (c *Client) Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *BoolResult

func (*Client) Move added in v1.0.0

func (c *Client) Move(ctx context.Context, key string, db int) *BoolResult

func (*Client) ObjectEncoding added in v1.0.0

func (c *Client) ObjectEncoding(ctx context.Context, key string) *StringResult

func (*Client) ObjectIdleTime added in v1.0.0

func (c *Client) ObjectIdleTime(ctx context.Context, key string) *DurationResult

func (*Client) ObjectRefCount added in v1.0.0

func (c *Client) ObjectRefCount(ctx context.Context, key string) *IntResult

func (*Client) PExpire added in v1.0.0

func (c *Client) PExpire(ctx context.Context, key string, expiration time.Duration) *BoolResult

func (*Client) PExpireAt added in v1.0.0

func (c *Client) PExpireAt(ctx context.Context, key string, tm time.Time) *BoolResult

func (*Client) PSetEX added in v1.0.0

func (c *Client) PSetEX(ctx context.Context, key string, value any, expiration time.Duration) *BoolResult

func (*Client) PTTL added in v1.0.0

func (c *Client) PTTL(ctx context.Context, key string) *DurationResult

func (*Client) Persist added in v1.0.0

func (c *Client) Persist(ctx context.Context, key string) *BoolResult

func (*Client) Ping added in v1.0.0

func (c *Client) Ping(ctx context.Context) *StringResult

func (*Client) Quit added in v1.0.0

func (c *Client) Quit(ctx context.Context) *StringResult

func (*Client) RPop added in v1.0.0

func (c *Client) RPop(ctx context.Context, key string) *StringResult

func (*Client) RPopLPush added in v1.0.0

func (c *Client) RPopLPush(ctx context.Context, source, destination string) *StringResult

func (*Client) RPush added in v1.0.0

func (c *Client) RPush(ctx context.Context, key string, values ...any) *IntResult

func (*Client) RPushX added in v1.0.0

func (c *Client) RPushX(ctx context.Context, key string, values ...any) *IntResult

func (*Client) RandomKey added in v1.0.0

func (c *Client) RandomKey(ctx context.Context) *StringResult

func (*Client) Rename added in v1.0.0

func (c *Client) Rename(ctx context.Context, key, newKey string) *BoolResult

func (*Client) RenameNX added in v1.0.0

func (c *Client) RenameNX(ctx context.Context, key, newKey string) *BoolResult

func (*Client) Restore added in v1.0.0

func (c *Client) Restore(ctx context.Context, key string, ttl time.Duration, value string) *BoolResult

func (*Client) RestoreReplace added in v1.0.0

func (c *Client) RestoreReplace(ctx context.Context, key string, ttl time.Duration, value string) *BoolResult

func (*Client) SAdd added in v1.0.0

func (c *Client) SAdd(ctx context.Context, key string, member any, members ...any) *IntResult

func (*Client) SCard added in v1.0.0

func (c *Client) SCard(ctx context.Context, key string) *IntResult

func (*Client) SDiff added in v1.0.0

func (c *Client) SDiff(ctx context.Context, keys ...string) *StringSliceResult

func (*Client) SDiffStore added in v1.0.0

func (c *Client) SDiffStore(ctx context.Context, destination string, keys ...string) *IntResult

func (*Client) SInter added in v1.0.0

func (c *Client) SInter(ctx context.Context, keys ...string) *StringSliceResult

func (*Client) SInterStore added in v1.0.0

func (c *Client) SInterStore(ctx context.Context, destination string, keys ...string) *IntResult

func (*Client) SIsMember added in v1.0.0

func (c *Client) SIsMember(ctx context.Context, key string, member any) *BoolResult

func (*Client) SMembers added in v1.0.0

func (c *Client) SMembers(ctx context.Context, key string) *StringSliceResult

func (*Client) SMove added in v1.0.0

func (c *Client) SMove(ctx context.Context, source, destination string, member any) *BoolResult

func (*Client) SPop added in v1.0.0

func (c *Client) SPop(ctx context.Context, key string) *StringResult

func (*Client) SRem added in v1.0.0

func (c *Client) SRem(ctx context.Context, key string, member any, members ...any) *IntResult

func (*Client) SScan added in v1.0.0

func (c *Client) SScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanResult

func (*Client) SUnion added in v1.0.0

func (c *Client) SUnion(ctx context.Context, keys ...string) *StringSliceResult

func (*Client) SUnionStore added in v1.0.0

func (c *Client) SUnionStore(ctx context.Context, destination string, keys ...string) *IntResult

func (*Client) Select added in v1.0.0

func (c *Client) Select(ctx context.Context, index int) *StringResult

func (*Client) Set added in v1.0.0

func (c *Client) Set(ctx context.Context, key string, value any, expireIn time.Duration) *BoolResult

func (*Client) SetBit added in v1.0.0

func (c *Client) SetBit(ctx context.Context, key string, offset int, value int64) *IntResult

func (*Client) SetEX added in v1.0.0

func (c *Client) SetEX(ctx context.Context, key string, value any, expiration time.Duration) *BoolResult

func (*Client) SetNX added in v1.0.0

func (c *Client) SetNX(ctx context.Context, key string, value any) *BoolResult

func (*Client) SetRange added in v1.0.0

func (c *Client) SetRange(ctx context.Context, key string, offset int, value any) *IntResult

func (*Client) SetXX added in v1.0.0

func (c *Client) SetXX(ctx context.Context, key string, value any) *BoolResult

func (*Client) StrLen added in v1.0.0

func (c *Client) StrLen(ctx context.Context, key string) *IntResult

func (*Client) SwapDB added in v1.0.0

func (c *Client) SwapDB(ctx context.Context, index1, index2 int) *StringResult
func (c *Client) Unlink(ctx context.Context, keys ...string) *IntResult

func (*Client) UnlinkCtx added in v1.0.0

func (c *Client) UnlinkCtx(ctx context.Context, keys ...string) *IntResult

func (*Client) Wait added in v1.0.0

func (c *Client) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntResult

type DurationResult added in v1.0.0

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

func (DurationResult) Duration added in v1.0.0

func (d DurationResult) Duration() time.Duration

func (DurationResult) Err added in v1.0.0

func (d DurationResult) Err() error

func (DurationResult) Result added in v1.0.0

func (d DurationResult) Result() (time.Duration, error)

type FloatResult

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

func (FloatResult) Err added in v1.0.0

func (f FloatResult) Err() error

func (FloatResult) Float64

func (f FloatResult) Float64() float64

func (FloatResult) Result added in v1.0.0

func (f FloatResult) Result() (float64, error)

func (FloatResult) Scan added in v1.0.0

func (f FloatResult) Scan(v any) error

func (FloatResult) String added in v1.0.0

func (f FloatResult) String() string

type FloatsParser added in v1.0.0

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

func (*FloatsParser) FloatResult added in v1.0.0

func (f *FloatsParser) FloatResult() *FloatResult

func (*FloatsParser) Parse added in v1.0.0

func (f *FloatsParser) Parse(ctx context.Context, reader io.Reader) error

func (*FloatsParser) SetErr added in v1.0.0

func (f *FloatsParser) SetErr(err error)

type IntResult

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

func (IntResult) Err added in v1.0.0

func (i IntResult) Err() error

func (IntResult) Int64

func (i IntResult) Int64() int64

func (IntResult) Result added in v1.0.0

func (i IntResult) Result() (int64, error)

func (IntResult) String added in v1.0.0

func (i IntResult) String() string

type IntegersParser added in v1.0.0

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

func (*IntegersParser) BoolResult added in v1.0.0

func (i *IntegersParser) BoolResult() *BoolResult

func (*IntegersParser) DurationResult added in v1.0.0

func (i *IntegersParser) DurationResult() *DurationResult

func (*IntegersParser) IntResult added in v1.0.0

func (i *IntegersParser) IntResult() *IntResult

func (*IntegersParser) Parse added in v1.0.0

func (i *IntegersParser) Parse(ctx context.Context, reader io.Reader) error

func (*IntegersParser) SetErr added in v1.0.0

func (i *IntegersParser) SetErr(err error)

type KeyValueParser added in v1.0.0

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

func (*KeyValueParser) KeyValueResult added in v1.0.0

func (k *KeyValueParser) KeyValueResult() *KeyValueResult

func (*KeyValueParser) Parse added in v1.0.0

func (k *KeyValueParser) Parse(ctx context.Context, reader io.Reader) error

func (*KeyValueParser) SetErr added in v1.0.0

func (k *KeyValueParser) SetErr(err error)

type KeyValueResult added in v1.0.0

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

func (KeyValueResult) Err added in v1.0.0

func (kv KeyValueResult) Err() error

func (KeyValueResult) Key added in v1.0.0

func (kv KeyValueResult) Key() string

func (KeyValueResult) Result added in v1.0.0

func (kv KeyValueResult) Result() (string, string, error)

func (KeyValueResult) String added in v1.0.0

func (kv KeyValueResult) String() string

func (KeyValueResult) Value added in v1.0.0

func (kv KeyValueResult) Value() string

type OptionFunc added in v1.0.0

type OptionFunc func(*Options)

func WithAddr added in v1.0.0

func WithAddr(addr string) OptionFunc

func WithDB added in v1.0.0

func WithDB(db int) OptionFunc

func WithDialer added in v1.0.0

func WithDialer(dialer func(ctx context.Context, network, addr string) (net.Conn, error)) OptionFunc

func WithMaxConnAge added in v1.0.0

func WithMaxConnAge(maxConnAge time.Duration) OptionFunc

func WithMaxRetries added in v1.0.0

func WithMaxRetries(maxRetries int) OptionFunc

func WithNetwork added in v1.0.0

func WithNetwork(network string) OptionFunc

func WithOnClose added in v1.0.0

func WithOnClose(onClose func(ctx context.Context, cn net.Conn)) OptionFunc

func WithOnConnect added in v1.0.0

func WithOnConnect(onConnect func(ctx context.Context, cn net.Conn)) OptionFunc

func WithPassword added in v1.0.0

func WithPassword(password string) OptionFunc

func WithPoolSize added in v1.0.0

func WithPoolSize(poolSize int) OptionFunc

func WithPoolTimeout added in v1.0.0

func WithPoolTimeout(poolTimeout time.Duration) OptionFunc

func WithUsername added in v1.0.0

func WithUsername(username string) OptionFunc

type Options

type Options struct {
	// Addr is the TCP address of the Redis server.
	// The address must be in the form "host:port".
	// If no port is specified, then 6379 is used.
	// If no host is specified, then "localhost" is used.
	// To use a Unix domain socket, provide a path to a socket file.
	Addr string
	// Network is the type of network to use.
	// It must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket".
	// Default is "tcp".
	Network string
	// Dialer is an optional dialer for creating TCP connections.
	// If Dialer is nil, then net.Dialer is used.
	Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
	// OnConnect is an optional hook executed when a new connection is established.
	// It receives a context and a connection. It is safe for OnConnect to read and
	// write to the connection.
	OnConnect func(ctx context.Context, cn net.Conn)
	// OnClose is an optional hook executed when a connection is closed.
	// It receives a context and a connection. It is safe for OnClose to read and
	// write to the connection.
	OnClose func(ctx context.Context, cn net.Conn)
	// Username is the username for AUTH (requires Redis 6 or above).
	Username string
	// Password is the password for AUTH (requires Redis 6 or above).
	Password string
	// DB is the Redis database to select.
	DB int
	// MaxRetries specifies the maximum number of retries before giving up.
	// Default is 3 retries.
	MaxRetries int
	// PoolSize is the maximum number of socket connections.
	// Default is 2 * runtime.NumCPU.
	PoolSize int32
	// MaxConnAge is the maximum amount of time a connection may be reused.
	// Expired connections may be closed lazily before reuse.
	// If the value is zero, then connections are reused forever.
	MaxConnAge time.Duration
	// PoolTimeout is the amount of time client waits for connection if all
	// connections are busy before returning an error.
	// If the value is zero and there are no idle connections, then
	// ErrPoolTimeout is returned.
	PoolTimeout time.Duration
	// IdleTimeout is the maximum amount of time an idle connection may remain idle
	// before closing itself.
	// If the value is zero, then idle connections are not closed.
	IdleTimeout time.Duration
}

type Parser added in v1.0.0

type Parser interface {
	Parse(ctx context.Context, reader io.Reader) error
}

type ProtocolParser added in v1.0.0

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

func NewProtocolParser added in v1.0.0

func NewProtocolParser(reader io.Reader) *ProtocolParser

func (ProtocolParser) Parse added in v1.0.0

func (p ProtocolParser) Parse() ([]byte, error)

type ScanParser added in v1.0.0

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

func (*ScanParser) Parse added in v1.0.0

func (s *ScanParser) Parse(ctx context.Context, reader io.Reader) error

func (*ScanParser) Scan added in v1.0.0

func (s *ScanParser) Scan() (cursor uint64, keys []string, err error)

func (*ScanParser) ScanResult added in v1.0.0

func (s *ScanParser) ScanResult() *ScanResult

func (*ScanParser) SetErr added in v1.0.0

func (s *ScanParser) SetErr(err error)

type ScanResult added in v1.0.0

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

func (ScanResult) Cursor added in v1.0.0

func (s ScanResult) Cursor() uint64

func (ScanResult) Err added in v1.0.0

func (s ScanResult) Err() error

func (ScanResult) Result added in v1.0.0

func (s ScanResult) Result() (uint64, []string, error)

func (ScanResult) Values added in v1.0.0

func (s ScanResult) Values() []string

type Scanner added in v1.0.0

type Scanner interface {
	Scan(v any) error
}

Scanner is the interface that wraps the Scan method.

type StringMapParser added in v1.0.0

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

func (*StringMapParser) Parse added in v1.0.0

func (s *StringMapParser) Parse(ctx context.Context, reader io.Reader) error

func (*StringMapParser) SetErr added in v1.0.0

func (s *StringMapParser) SetErr(err error)

func (*StringMapParser) StringMap added in v1.0.0

func (s *StringMapParser) StringMap() map[string]string

func (*StringMapParser) StringMapResult added in v1.0.0

func (s *StringMapParser) StringMapResult() *StringMapResult

type StringMapResult added in v1.0.0

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

func (StringMapResult) Err added in v1.0.0

func (s StringMapResult) Err() error

func (StringMapResult) Result added in v1.0.0

func (s StringMapResult) Result() (map[string]string, error)

func (StringMapResult) Scan added in v1.0.0

func (s StringMapResult) Scan(v any) error

func (StringMapResult) StringMap added in v1.0.0

func (s StringMapResult) StringMap() map[string]string

type StringParser added in v1.0.0

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

StringParser implement

func (*StringParser) BoolResult added in v1.0.0

func (s *StringParser) BoolResult() *BoolResult

func (*StringParser) Parse added in v1.0.0

func (s *StringParser) Parse(ctx context.Context, reader io.Reader) error

func (*StringParser) SetErr added in v1.0.0

func (s *StringParser) SetErr(err error)

func (*StringParser) String added in v1.0.0

func (s *StringParser) String() string

func (*StringParser) StringResult added in v1.0.0

func (s *StringParser) StringResult() *StringResult

type StringResult

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

func (StringResult) Bool added in v1.0.0

func (s StringResult) Bool() (bool, error)

func (StringResult) Bytes added in v1.0.0

func (s StringResult) Bytes() ([]byte, error)

func (StringResult) Err added in v1.0.0

func (s StringResult) Err() error

func (StringResult) Float64 added in v1.0.0

func (s StringResult) Float64() (float64, error)

func (StringResult) Int added in v1.0.0

func (s StringResult) Int() (int, error)

func (StringResult) Int64 added in v1.0.0

func (s StringResult) Int64() (int64, error)

func (StringResult) MarshalJSON added in v1.0.0

func (s StringResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (StringResult) Result added in v1.0.0

func (s StringResult) Result() (string, error)

func (StringResult) Scan added in v1.0.0

func (s StringResult) Scan(v any) error

func (StringResult) String

func (s StringResult) String() string

func (StringResult) Uint64 added in v1.0.0

func (s StringResult) Uint64() (uint64, error)

func (StringResult) UnmarshalJSON added in v1.0.0

func (s StringResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type StringSliceParser added in v1.0.0

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

func (*StringSliceParser) Parse added in v1.0.0

func (s *StringSliceParser) Parse(ctx context.Context, reader io.Reader) error

func (*StringSliceParser) SetErr added in v1.0.0

func (s *StringSliceParser) SetErr(err error)

func (*StringSliceParser) StringSliceResult added in v1.0.0

func (s *StringSliceParser) StringSliceResult() *StringSliceResult

func (*StringSliceParser) Strings added in v1.0.0

func (s *StringSliceParser) Strings() []string

type StringSliceResult added in v1.0.0

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

func (StringSliceResult) Err added in v1.0.0

func (s StringSliceResult) Err() error

func (StringSliceResult) Result added in v1.0.0

func (s StringSliceResult) Result() ([]string, error)

func (StringSliceResult) Scan added in v1.0.0

func (s StringSliceResult) Scan(v any) error

func (StringSliceResult) Strings added in v1.0.0

func (s StringSliceResult) Strings() []string

Jump to

Keyboard shortcuts

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