store

package
v0.0.0-...-af57f77 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL string
	DB  string
}

Config mongodb configuration parameters

func NewConfig

func NewConfig(url, db string) *Config

NewConfig create mongodb configuration

type UserConfig

type UserConfig struct {
	// store users data collection name(The default is user)
	UsersCName string
}

UserConfig user configuration parameters

func NewDefaultUserConfig

func NewDefaultUserConfig() *UserConfig

NewDefaultUserConfig create a default user configuration

type UserStore

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

UserStore MongoDB storage for OAuth 2.0

func NewUserStore

func NewUserStore(cfg *Config, ucfgs ...*UserConfig) (*UserStore, error)

NewUserStore create a user store instance based on mongodb

func NewUserStoreWithSession

func NewUserStoreWithSession(session *mgo.Session, dbName string, ucfgs ...*UserConfig) (*UserStore, error)

NewUserStoreWithSession create a User store instance based on mongodb

func (*UserStore) Close

func (us *UserStore) Close()

Close close the mongo session

func (*UserStore) GetAllUsers

func (us *UserStore) GetAllUsers() (users []*models.UserCredentials, err error)

GetAllUsers according to the ID for the user information

func (*UserStore) GetByEmail

func (us *UserStore) GetByEmail(email string) (user *models.UserCredentials, err error)

GetByEmail according to the ID for the user information

func (*UserStore) GetByUserName

func (us *UserStore) GetByUserName(username string) (user *models.UserCredentials, err error)

GetByUserName according to the ID for the user information

func (*UserStore) RemoveByUserName

func (us *UserStore) RemoveByUserName(username string) (err error)

RemoveByUserName use the user id to delete the user information

func (*UserStore) Set

func (us *UserStore) Set(user *models.UserCredentials) (err error)

Set set user information

func (*UserStore) UpdateUser

func (us *UserStore) UpdateUser(user *models.UserCredentials) (err error)

UpdateUser updates the user

Jump to

Keyboard shortcuts

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