repo

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const USER_COLLECTION_NAME = "user"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityItem

type ActivityItem struct {
	Type      string `bson:",omitempty"`
	Content   string `json:"content,omitempty" bson:",omitempty"`
	TimeStamp int64  `json:"timestamp,omitempty" bson:",omitempty"`
}

type KeyChainItem

type KeyChainItem struct {
	Content    string `json:"content,omitempty" bson:",omitempty"`
	Secret     string `json:"secret,omitempty" bson:",omitempty"`
	Expiration int64  `json:"expiration,omitempty" bson:",omitempty"`
}

type KeyType

type KeyType struct{}

type User

type User struct {
	ID            string                  `json:"id,omitempty" bson:"_id,omitempty"`
	Username      string                  `json:"username,omitempty" bson:",omitempty"`
	Email         string                  `json:"email,omitempty" bson:",omitempty"`
	AccessControl string                  `json:"accessControl,omitempty" bson:",omitempty"`
	Activity      []ActivityItem          `bson:",omitempty"`
	KeyChain      map[string]KeyChainItem `bson:",omitempty"`
}

type UserId

type UserId struct{}

type UserRepo

type UserRepo struct {
	Client mongo.Client
	Coll   *mongo.Collection
	// contains filtered or unexported fields
}

func InitUserRepo

func InitUserRepo(ctx context.Context, client *mongo.Client) *UserRepo

func (*UserRepo) Create

func (repo *UserRepo) Create(ctx context.Context, user User) (string, error)

func (*UserRepo) Delete

func (repo *UserRepo) Delete(ctx context.Context) (int, error)

func (*UserRepo) DeleteKeychain

func (repo *UserRepo) DeleteKeychain(ctx context.Context) (bson.M, error)

func (*UserRepo) Read

func (repo *UserRepo) Read(ctx context.Context, sort string, limit int64, offset int64, id string) ([]User, error)

func (*UserRepo) Update

func (repo *UserRepo) Update(ctx context.Context, user User) (int, error)

func (*UserRepo) UpsertKeychain

func (repo *UserRepo) UpsertKeychain(ctx context.Context, keychain *KeyChainItem) (bson.M, error)

func (*UserRepo) ValidatePassword added in v0.1.3

func (repo *UserRepo) ValidatePassword(ctx context.Context, username string, password string) (*User, error)

Jump to

Keyboard shortcuts

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