data

package
v0.0.0-...-27dfecd Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDocument     = errors.New("error no document")
	ErrCreateDocument = errors.New("error create document")
	ErrUpdateDocument = errors.New("error update document")
	ErrDeleteDocument = errors.New("error delete document")
)

Functions

This section is empty.

Types

type AuthCred

type AuthCred struct {
	Email    string `json:"email,omitempty"`
	Password string `json:"password,omitempty"`
}

type Models

type Models struct {
	User interface {
		Create(ctx context.Context, user *User) error

		GetByID(ctx context.Context, id string) (*User, error)

		Get(ctx context.Context, skip, limit int64) (*[]User, error)

		GetByEmail(ctx context.Context, email string) (*User, error)

		GetByPhone(ctx context.Context, phone string) (*User, error)

		Update(ctx context.Context, id string, user *User) error

		DeleteByID(ctx context.Context, id string) error
	}
}

type TokenStr

type TokenStr struct {
	Value string `json:"value,omitempty"`
}

type User

type User struct {
	ID            string    `json:"id,omitempty" bson:"_id,omitempty"`
	FirstName     string    `json:"first_name,omitempty" bson:"first_name,omitempty"`
	LastName      string    `json:"last_name,omitempty" bson:"last_name,omitempty"`
	DisplayName   string    `json:"display_name,omitempty" bson:"display_name,omitempty"`
	Phone         string    `json:"phone,omitempty" bson:"phone,omitempty"`
	Email         string    `json:"email,omitempty" bson:"email,omitempty"`
	EmailVerified string    `json:"email_verified,omitempty" bson:"email_verified,omitempty"`
	Password      string    `json:"password,omitempty" bson:"password,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"`
}

type UserModel

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

func NewUserModel

func NewUserModel(client *mongo.Client) *UserModel

func (UserModel) Create

func (u UserModel) Create(ctx context.Context, user *User) error

func (UserModel) DeleteByID

func (u UserModel) DeleteByID(ctx context.Context, id string) error

func (UserModel) Get

func (u UserModel) Get(ctx context.Context, skip, limit int64) (*[]User, error)

func (UserModel) GetByEmail

func (u UserModel) GetByEmail(ctx context.Context, email string) (*User, error)

func (UserModel) GetByID

func (u UserModel) GetByID(ctx context.Context, id string) (*User, error)

func (UserModel) GetByPhone

func (u UserModel) GetByPhone(ctx context.Context, phone string) (*User, error)

func (UserModel) Update

func (u UserModel) Update(ctx context.Context, id string, user *User) error

Jump to

Keyboard shortcuts

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