vmod

package
v1.4.23 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeletedResponse added in v1.4.21

type DeletedResponse struct {
	ID string `json:"id"`
}

DeletedResponse used for handling response in deleted case.

type IDParam added in v1.4.21

type IDParam struct {
	ID string `param:"id" validate:"uuid"`
}

IDParam data struct for handling '/:id'. ID needs to be a uuid.

type Modified

type Modified struct {
	Updated int64 `json:"updated" bson:"updated"`
	Created int64 `json:"created" bson:"created"`
}

Modified contains update and create time for an model.

func NewModified added in v0.0.8

func NewModified() Modified

NewModified initial Modified model.

func (*Modified) Update added in v0.1.0

func (i *Modified) Update()

Update updates the Updated key to the current time.

type Money added in v1.4.4

type Money struct {
	Amount   int64  `bson:"amount" json:"amount"`
	Currency string `bson:"currency" json:"currency" validate:"required"`
}

Money represent the simple Money object. The Amount is a cent representation.

type Position added in v1.4.4

type Position struct {
	Lat float64 `json:"lat" bson:"lat"`
	Lng float64 `json:"lng" bson:"lng"`
}

Position represents the lat and lng coordinates for latitude and longitude.

type Role added in v1.4.4

type Role struct {
	ID     string `json:"id" bson:"_id"`
	Name   string `json:"name" bson:"name"`
	Label  string `json:"label" bson:"label"`
	Root   string `json:"root" bson:"root"`
	UserID string `json:"user_id" bson:"user_id"`
}

Role represents an struct for handling access roles.

func RoleAdmin added in v1.4.4

func RoleAdmin(userID string) *Role

RoleAdmin represents the admin role.

func RoleEmployee added in v1.4.4

func RoleEmployee(userID string) *Role

RoleEmployee represents the employee role.

func RoleMember added in v1.4.4

func RoleMember(userID string) *Role

RoleMember represents the member role.

type RoleList added in v1.4.4

type RoleList []Role

RoleList represents an slice of Role

func (*RoleList) Append added in v1.4.4

func (i *RoleList) Append(role *Role)

Append append a Role role to a RoleList i. If i contains the role, nothing happend.

func (*RoleList) Cookie added in v1.4.4

func (i *RoleList) Cookie() (r *RoleListCookie)

Cookie return an slice of strings they contains all role names.

func (*RoleList) In added in v1.4.4

func (i *RoleList) In(role string) bool

In check if a the RoleList contains an role.

type RoleListCookie added in v1.4.4

type RoleListCookie []string

RoleListCookie used for the access_token.

func (*RoleListCookie) CheckRoot added in v1.4.4

func (i *RoleListCookie) CheckRoot(role *Role) bool

CheckRoot check if the RoleListCookie object contains an role in the Root param. So you can check if an user is allow to give an other user an role.

func (*RoleListCookie) Validate added in v1.4.4

func (i *RoleListCookie) Validate(roles string) bool

Validate check if an RoleListCookie contains an role in the roles string. We seperate the role by ;.

Example:

"admin;employee"

type User

type User struct {
	ID            string   `json:"id,omitempty" bson:"_id"`
	Email         string   `json:"email" bson:"email"`
	FirstName     string   `bson:"first_name" json:"first_name"`
	LastName      string   `bson:"last_name" json:"last_name"`
	FullName      string   `bson:"full_name" json:"full_name"`
	RealName      string   `bson:"real_name" json:"real_name"`
	DisplayName   string   `bson:"display_name" json:"display_name"`
	Roles         RoleList `json:"system_roles" bson:"system_roles"`
	Country       string   `bson:"country" json:"country"`
	PrivacyPolicy bool     `bson:"privacy_policy" json:"privacy_policy"`
	Confirmd      bool     `bson:"confirmed" json:"confirmed"`
	LastUpdate    string   `bson:"last_update" json:"last_update"`
}

User represents the user default user information they are shared with all viva con agua services.

func (*User) CheckUpdate added in v1.4.4

func (i *User) CheckUpdate(lastUpdate string) bool

CheckUpdate checks if the lastUpdate time string is older as the users LastUpdate param. If the function return true, the user needs to be updated in this service.

func (*User) Load added in v1.4.4

func (i *User) Load(user interface{}) (err error)

Load loads an interface in an vcago.User model

Jump to

Keyboard shortcuts

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