goauthmongo

package
v0.0.0-...-c36fa23 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtxCreator

func CtxCreator(timeout int) (context.Context, context.CancelFunc)

CtxCreator Create context return context and cancelFunc

Types

type Client

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

Client Used for client type

func NewClient

func NewClient(uri string) (*Client, error)

NewClient Create new client and return the client

func (*Client) Disconnect

func (c *Client) Disconnect()

Disconnect Close the connection to the server

func (*Client) DropDB

func (c *Client) DropDB(dbName string) error

DropDB Drop the named database

func (*Client) GetCollection

func (c *Client) GetCollection(dbName string, collName string) *mongo.Collection

GetCollection Get a collection from a database

type UserCollection

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

UserCollection Holds a collection and other methods to manipulate it

func NewUserCollection

func NewUserCollection(client *Client, dbName string, collName string, hash *goauthcrypto.HashStr) *UserCollection

NewUserCollection Creates new user service to holds the collection (table)

func (*UserCollection) CreateUser

func (uc *UserCollection) CreateUser(u *goauthpkg.UserObj) error

CreateUser Insert new user to the user Collection

func (*UserCollection) GetAllUser

func (uc *UserCollection) GetAllUser() (*[]string, error)

GetAllUser get all user object from mongodb

func (*UserCollection) GetByUsername

func (uc *UserCollection) GetByUsername(username string) (goauthpkg.UserObj, error)

GetByUsername get user from mongodb

func (*UserCollection) Login

Login let user log into server

Jump to

Keyboard shortcuts

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