vmod

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content added in v1.4.37

type Content struct {
	Fields map[string]interface{} `json:"content" bson:"content"`
}

type Count added in v1.4.32

type Count struct {
	Total int32 `json:"total" bson:"total"`
}

Count is used for counting results in db aggregations

type DeletedResponse added in v1.4.21

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

DeletedResponse used for handling response in deleted case.

func NewDeletedResponse added in v1.4.24

func NewDeletedResponse(id string) *DeletedResponse

NewDeletedResponse creates a new DeletedResponse type.

type File added in v1.4.44

type File struct {
	File   multipart.File
	Header *multipart.FileHeader
}

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 ModelID added in v1.5.0

type ModelID struct {
	MID  string `json:"id" bson:"id"`
	Type string `json:"type" bson:"type"`
}

func NewModelID added in v1.5.0

func NewModelID(mID string, mType string) *ModelID

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