session

package
v0.0.0-...-3bd2bae Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, mg *db.MongoDB, res *sessionsv2.Session, expire bool) (*sessionsv2.Session, error)

Create returns a new session object on successful insert

func EnsureIndex

func EnsureIndex(ctx context.Context, mg *db.MongoDB) error

EnsureIndex on mongodb

func GetByAccountID

func GetByAccountID(ctx context.Context, mg *db.MongoDB, id string) (*sessionsv2.Session, error)

GetByAccountID returns a session object from sessions collection by key/value account_id if exists, otherwise an error

func GetByEmail

func GetByEmail(ctx context.Context, mg *db.MongoDB, email string) (*sessionsv2.Session, error)

GetByEmail returns a session object from sessions collection by key/value email if exists, otherwise an error

func GetByID

func GetByID(ctx context.Context, mg *db.MongoDB, id string) (*sessionsv2.Session, error)

GetByID returns a session object from sessions collection if exists, otherwise an error

func Key

func Key(i string) func(*ListOptions)

Key Option

func List

List session with query

func Message

func Message(i string) func(*ListOptions)

Message Option

func NewListOpts

func NewListOpts() []func(*ListOptions)

NewListOpts returns list options

func ParseOptions

func ParseOptions(o *sessionsv2.Session) []func(*ListOptions)

ParseOptions parse query filters from interface

func Value

func Value(i string) func(*ListOptions)

Value Option

Types

type ListOptions

type ListOptions struct {
	Limit   int64
	Id      string
	Key     string
	Value   string
	Message string
}

ListOptions model for account endpoint queries

func DefaultOptions

func DefaultOptions() ListOptions

DefaultOptions returns the defaults

func Filter

func Filter(optionsList ...func(*ListOptions)) (ListOptions, bson.M)

Filter parses an option list to a bson.M query

Jump to

Keyboard shortcuts

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