model

package
v0.0.0-...-b4e6d96 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2016 License: MPL-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbMap

type DbMap struct {
	UserAccount                UserAccount
	UserPassword               UserPassword
	UserEmail                  UserEmail
	UserPersonalInformation    UserPersonalInformation
	Module                     Module
	Operation                  Operation
	Permission                 Permission
	Role                       Role
	OperationPermissionManager OperationPermissionManager
	PermissionRoleManager      PermissionRoleManager
}

TbMap is a set of db mapping.

type Module

type Module interface {
	Create(moduleData *ModuleData) error //missing model data
	GetByID(id uint64) (error, *ModuleData)
	DeleteByID(id uint64) error
	Update(ModuleData *ModuleData) error
}

type ModuleData

type ModuleData struct {
	ID             int64
	Name           string
	ParentModuleID sql.NullInt64
}

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

type Operation

type Operation interface {
	Create(operationData *OperationData) error
	GetByID(id int64) (error, *OperationData)
	DeleteByID(id int64) error
	Update(OperationData *OperationData) error
}

type OperationData

type OperationData struct {
	ID       int64
	Name     string
	ModuleID int64
}

type OperationPermissionManager

type OperationPermissionManager interface {
	SetPermissionOperations(permissionID int64, operationIDs []int64) error
	AddPermissionOperations(permissionID int64, operationIDs []int64) error
	RemovePermissionOperations(permissionID int64, operationIDs []int64) error
	GetOperationPermissions(operationID int64) (error, []*PermissionData)
	GetPermissionOperations(permissionID int64) (error, []*OperationData)
}

type Permission

type Permission interface {
	Create(permissionData *PermissionData) error
	GetByID(id int64) (error, *PermissionData)
	DeleteByID(id int64) error
	Update(permissionData *PermissionData) error
}

type PermissionData

type PermissionData struct {
	ID          int64
	Description string
}

type PermissionRoleManager

type PermissionRoleManager interface {
	SetRolePermissions(roleID int64, permissionsIDs []int64) error
	AddRolePermissions(roleID int64, permissionsIDs []int64) error
	RemoveRolePermissions(roleID int64, permissionsIDs []int64) error
	GetPermissionRoles(permissionID int64) (error, []*RoleData)
	GetRolePermissions(roleID int64) (error, []*PermissionData)
}

type Role

type Role interface {
	Create(roleData *RoleData) error
	GetByID(id int64) (error, *RoleData)
	DeleteByID(id int64) error
	Update(roleData *RoleData) error
	HasPermission(roleData *RoleData, operationPath string) (error, bool) // TODO:Maybe we should not tell when a op exists
}

type RoleData

type RoleData struct {
	ID           int64
	Description  string
	ParentRoleID sql.NullInt64
}

type UserAccount

type UserAccount interface {
	Create(userAccountData *UserAccountData) error
	GetByUsername(username string) (error, *UserAccountData)
	GetByID(id int64) (error, *UserAccountData)
	DeleteByID(id int64) error
	Update(userAccountData *UserAccountData) error
}

type UserAccountData

type UserAccountData struct {
	ID                   int64
	Username             string
	RegistrationDateTime time.Time
}

type UserEmail

type UserEmail interface {
	Create(userEmailData *UserEmailData) error
	Update(userEmailData *UserEmailData) error
	DeleteByAddress(address string) error
	GetByAddress(address string) (error, *UserEmailData)
}

type UserEmailData

type UserEmailData struct {
	UserAccountId        int64
	Address              string
	Verified             bool
	RegistrationDateTime time.Time
}

type UserPassword

type UserPassword interface {
	Create(userPasswordData *UserPasswordData) error
	Update(userPasswordData *UserPasswordData) error
	DeleteByID(id int64) error
	GetByID(id int64) (error, *UserPasswordData)
}

type UserPasswordData

type UserPasswordData struct {
	ID                   int64
	UserAccountID        int64
	Password             string
	Salt                 string
	RegistrationDateTime time.Time
}

type UserPersonalInformation

type UserPersonalInformation interface {
	Create(userPersonalInformation *UserPersonalInformation) error
	Update(userPersonalInformation *UserPersonalInformation) error
	DeleteById(id int64) error
	GetById(id int64) (error, *UserPersonalInformation)
}

type UserPersonalInformationData

type UserPersonalInformationData struct {
	ID                   int64
	UserAccountID        int64
	GivenName            string
	LastName             string
	MotherName           string
	FatherName           string
	Nationality          string
	RegistrationDatetime time.Time
}

Jump to

Keyboard shortcuts

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