models

package
v0.0.0-...-f501c68 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessAddToBson

func AccessAddToBson(idM interface{}, idR interface{}, accessI interface{}) (*Module, *Role, *Access, *bson.M, error)

cast accesses to list of bson.M

func AccessUpdateToBson

func AccessUpdateToBson(nA interface{}, idA interface{}, accessI interface{}) (primitive.ObjectID, primitive.ObjectID, primitive.ObjectID, int, string, error)

func Login

func Login(nickI interface{}, passI interface{}) (string, string, error)

func OperationUpdateToBson

func OperationUpdateToBson(idV interface{}, operI interface{}) (*primitive.ObjectID, *bson.M, error)

func RoleAddToBson

func RoleAddToBson(idM interface{}, RoleI interface{}) (*Module, *Role, *bson.M, error)

func UserGenericToBson

func UserGenericToBson(userI interface{}) (*primitive.ObjectID, *bson.M, error)

func ViewToBson

func ViewToBson(idM interface{}, viewI interface{}) (*Module, *View, *bson.M, error)

Types

type Access

type Access struct {
	Id       primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	View     primitive.ObjectID `bson:"view"`
	Order    int                `bson:"order"`
	Position string             `bson:"position"`
}

func (*Access) ToBson

func (a *Access) ToBson() bson.M

type Module

type Module struct {
	Id    primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Name  string             `bson:"name"`
	Icon  string             `bson:"icon"`
	Color string             `bson:"color"`
	Roles []Role             `bson:"roles"`
	Views []View             `bson:"views"`
}

func ModuleToBson

func ModuleToBson(moduleI interface{}) (*Module, *bson.M, error)

func ModuleUpdateToBson

func ModuleUpdateToBson(idI interface{}, moduleI interface{}) (*Module, *bson.M, error)

func (*Module) New

func (m *Module) New(id primitive.ObjectID, name string, icon string, color string, roles []Role, views []View) Module

func (*Module) ToBson

func (m *Module) ToBson() bson.M

type Operation

type Operation struct {
	Id          primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Name        string             `bson:"name"`
	Description string             `bson:"description"`
	CRUD        int                `bson:"crud"`
}

func OperationAddToBson

func OperationAddToBson(operI interface{}) (*Operation, *bson.M, error)

type Role

type Role struct {
	Id          primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Name        string             `bson:"name"`
	Description string             `bson:"description"`
	Accesses    []Access           `bson:"accesses"`
}

func RoleUpdateToBson

func RoleUpdateToBson(idR interface{}, RoleI interface{}) (*Role, error)

func (*Role) New

func (r *Role) New(id primitive.ObjectID, name string, description string, access []Access) Role

func (*Role) ToBsonM

func (r *Role) ToBsonM() bson.M

type User

type User struct {
	Id       primitive.ObjectID   `json:"_id,omitempty" bson:"_id,omitempty"`
	Names    string               `bson:"names"`
	Ln       string               `bson:"ln"`  //last name
	Mln      string               `bson:"mln"` //mother last name
	Dni      string               `bson:"dni"`
	Photo    string               `bson:"photo"`
	Nick     string               `bson:"nick"`
	Email    string               `bson:"email"`
	Password string               `bson:"password"`
	Roles    []primitive.ObjectID `bson:"roles"`
}

func UserToBson

func UserToBson(userI interface{}) (*User, *bson.M, error)

func UserUpdateToBson

func UserUpdateToBson(idI interface{}, userI interface{}) (*User, *bson.M, error)

func (*User) New

func (u *User) New(id primitive.ObjectID, Dni string,
	Nick string, Email string, Password string, Roles []primitive.ObjectID) User

Constructor for User model

func (*User) ToBson

func (u *User) ToBson() bson.M

type View

type View struct {
	Id          primitive.ObjectID   `json:"id" bson:"_id,omitempty"`
	Name        string               `bson:"name"`
	Description string               `bson:"description"`
	Url         string               `bson:"url"`
	Icon        string               `bson:"icon"`
	Operations  []primitive.ObjectID `bson:"operations"`
}

func ViewUpdateToBson

func ViewUpdateToBson(idV interface{}, viewI interface{}) (*View, error)

func (*View) New

func (v *View) New(id primitive.ObjectID, Name string, Description string, Url string, Icon string) View

Constructor for View model

func (*View) ToBsonM

func (v *View) ToBsonM() bson.M

Jump to

Keyboard shortcuts

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