user

package
v0.0.0-...-bb5f922 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDatabase

type IDatabase interface {
	InsertUser(t User) error
	FindUser(u uuid.UUID) (User, error)
	UpdateUser(t User, u uuid.UUID) error
	DeleteUser(u uuid.UUID) error
}

IDatabase list the methods a database needs to implement, in order to work with user's package.

type IService

type IService interface {
	CreateUser(u *User) (User, error)
	ReadUser(u uuid.UUID) (t User, err error)
	UpdateUser(t *User, u uuid.UUID) error
	DeleteUser(u uuid.UUID) error
}

IService lists the methods the user service implements.

func NewService

func NewService(db IDatabase) IService

NewService returns a pointer to new instance of the user service.

type Location

type Location struct {
	Lat string `json:"lat,required"`
	Lng string `json:"lng,required"`
}

Location stores user location data

type User

type User struct {
	UUID      uuid.UUID `json:"uuid" bson:"_id"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	Name      string    `json:"name" bson:"name"`
}

User stores user data

Jump to

Keyboard shortcuts

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