user

package
v0.0.0-...-153da20 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BulkUpload

func BulkUpload(ctx context.Context, records [][]string) error

func ImportUsersFromCsv

func ImportUsersFromCsv(ctx context.Context, filepath string) error

func ImportUsersFromCsvBytes

func ImportUsersFromCsvBytes(ctx context.Context, data []byte) error

Types

type Option

type Option func(*User) error

func Active

func Active(isActive bool) Option

func ID

func ID(id string) Option

type User

type User struct {
	ID        string `bson:"_id,omitempty" json:"id,omitempty"`
	FirstName string `bson:"first_name" json:"first_name" validate:"required"`
	LastName  string `bson:"last_name" json:"last_name" validate:"required"`
	Email     string `bson:"email" json:"email"`
	Password  string `bson:"password" json:"-"`
	Activated bool   `bson:"activated" json:"activated"`
	Created   string `bson:"created" json:"created"`
	Modified  string `bson:"modified" json:"modified"`
}

func NewUser

func NewUser(opts ...Option) (*User, error)

func (*User) Bind

func (u *User) Bind(data []string) error

func (*User) Store

func (user *User) Store(c context.Context) (string, error)

func (*User) Validate

func (u *User) Validate() error

type Users

type Users []*User

func GetAll

func GetAll(c context.Context) (Users, error)

func (Users) StoreBulk

func (users Users) StoreBulk(c context.Context) (int, error)

Jump to

Keyboard shortcuts

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