1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-31 05:04:23 +03:00

feat(scan): add Scanner interface (#2317)

Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
Monkey
2022-12-24 22:29:45 +08:00
committed by GitHub
parent 7c4b924350
commit a4336cbd43
5 changed files with 94 additions and 10 deletions

View File

@ -10,6 +10,12 @@ import (
// decoderFunc represents decoding functions for default built-in types.
type decoderFunc func(reflect.Value, string) error
// Scanner is the interface implemented by themselves,
// which will override the decoding behavior of decoderFunc.
type Scanner interface {
ScanRedis(s string) error
}
var (
// List of built-in decoders indexed by their numeric constant values (eg: reflect.Bool = 1).
decoders = []decoderFunc{