Skip to content

Conversation

@monkey92t
Copy link
Collaborator

@monkey92t monkey92t commented Dec 17, 2022

Add Scanner interface, scanner is an interface for custom decoding:

See #2298 #2295 #1631

type TimeValue struct {
	time.Time
}

func (t *TimeValue) ScanRedis(s string) (err error) {
	t.Time, err = time.Parse(time.RFC3339Nano, s)
	return
}

type Data struct {
	Name      string     `redis:"name"`
	LoginTime TimeValue  `redis:"login_time"`
}

var d Data
err := client.MGet(ctx, "name", "login_time").Scan(&d)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant