user

package
v0.0.0-...-76732a0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Name       string    `bson:"name"`
	UploadedAt time.Time `bson:"uploaded_at"`
}

type MongoClient

type MongoClient struct {
	Client *mongo.Client
}

func NewMongoClient

func NewMongoClient(ctx context.Context, options *Options) (*MongoClient, error)

func (*MongoClient) Create

func (mc *MongoClient) Create(user User) (User, error)

func (*MongoClient) Read

func (mc *MongoClient) Read(key string, value interface{}) (User, error)

func (*MongoClient) Update

func (mc *MongoClient) Update(obj interface{}, key string, value interface{}) error

type Options

type Options struct {
	Host     string
	Port     string
	User     string
	Password string
	DB       string
}

type User

type User struct {
	ID           primitive.ObjectID `bson:"_id"`
	UserID       string             `bson:"user_id"`
	Email        string             `bson:"email" validate:"email,required"`
	Password     string             `bson:"password" validate:"required,min=6"`
	Token        string             `bson:"token"`
	RefreshToken string             `bson:"refresh_token"`
	CreatedAt    time.Time          `bson:"created_at"`
	UpdatedAt    time.Time          `bson:"updated_at"`
	Files        []File             `bson:"files"`
}

Jump to

Keyboard shortcuts

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