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

oauthgostore

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemorySessionStore

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

MemorySessionStore is a simple in-memory session store.

func (*MemorySessionStore) Del

func (m *MemorySessionStore) Del(ctx context.Context, id string) error

Del deletes a session from the store.

func (*MemorySessionStore) Get

Get retrieves a session from the store.

func (*MemorySessionStore) Put

Put stores a session in the store.

type RedisSessionStore

type RedisSessionStore struct {
	Client *redis.Client
	Prefix string
}

RedisSessionStore is a session store that uses Redis.

func (*RedisSessionStore) Del

func (s *RedisSessionStore) Del(ctx context.Context, id string) error

Del deletes a session from the store.

func (*RedisSessionStore) Get

Get retrieves a session from the store.

func (*RedisSessionStore) Put

Put stores a session in the store.

type SessionData

type SessionData struct {
	Provider     string
	Subject      string
	Email        string
	Name         string
	AccessToken  string
	RefreshToken string
	Expiry       time.Time
	CreatedAt    time.Time
}

SessionData is the data stored in the session store.

type SessionStore

type SessionStore interface {
	Put(ctx context.Context, id string, data SessionData, ttl time.Duration) error
	Get(ctx context.Context, id string) (SessionData, bool, error)
	Del(ctx context.Context, id string) error
}

SessionStore is an interface for storing and retrieving sessions.

func NewMemorySessionStore

func NewMemorySessionStore() SessionStore

NewMemorySessionStore creates a new MemorySessionStore.

func NewRedisSessionStore

func NewRedisSessionStore(client *redis.Client, prefix string) SessionStore

NewRedisSessionStore creates a new RedisSessionStore.

Jump to

Keyboard shortcuts

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