interfaces

package
v0.0.0-...-cf93416 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat string = "Mon Jan 2 15:04:05"

TimeFormat is string for convert timestamp to string.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppModuleEntry

type AppModuleEntry struct {
	ObjectID string `bson:"_id,omitempty" json:"-"`
	ID       string `json:"id" bson:"-"`
	Name     string `json:"name" bson:"name"`
	Comment  string `json:"comment" bson:"comment"`
	IsON     bool   `json:"isON" bson:"isON"`
}

AppModuleEntry describes the user session record.

func CopyAppModuleData

func CopyAppModuleData(v AppModuleEntry) *AppModuleEntry

CopyAppModuleData returns a copy of the session record.

func NewEmptyAppModule

func NewEmptyAppModule() AppModuleEntry

NewEmptyAppModule returns a new empty session record.

func (*AppModuleEntry) GetBSOND

func (v *AppModuleEntry) GetBSOND() bson.D

GetBSOND Returns Object as BSON.d

type Database

type Database interface {
	// REST
	CreateUser(string, string, string, bool, bool) (*UserEntry, error)
	GetAllUsers() ([]UserEntry, error)
	GetUserByID(string) (*UserEntry, error)
	DeleteUserByID(string) error
	UpdateUserByID(string, *UserEntry) error
	// REST extension
	GetUserByUsername(string) (*UserEntry, error)

	CreateSession(string, int64) (*SessionEntry, error)
	GetSessionByUUID(string) (*SessionEntry, error)
	UpdateSessionByUUID(string, *SessionEntry) error
	DeleteSessionByUUID(string) error
	DeleteExpireSession() error

	// REST
	CreateTask(string, string, string, string, bool, bool) (*TaskEntry, error)
	GetAllTasks() ([]TaskEntry, error)
	GetTaskByID(string) (*TaskEntry, error)
	UpdateTaskStatusByID(string, string) error
	// REST extension
	СheckIfTaskAlreadyCreate(string, string) bool
	GetWaitingTask() (*TaskEntry, error)
	GetLastCompleteTaskByResourceAndName(string, string) (*TaskEntry, error)
	UpdateTaskStatusAtStartup() error

	// REST
	CreateAppModule(string, string, bool) (*AppModuleEntry, error)
	GetAllAppModules() ([]AppModuleEntry, error)
	GetAppModuleByID(string) (*AppModuleEntry, error)
	UpdateAppModuleByID(string, *AppModuleEntry) error
	// REST extension
	GetAppModuleByName(string) (*AppModuleEntry, error)

	UploadFile(string, string) error
	DownloadFile(string) []byte
	CheckFile(string) bool

	Close()
}

Database describes the database object interface.

type SessionEntry

type SessionEntry struct {
	ObjectID string `bson:"_id,omitempty" json:"-"`
	ID       string `json:"id" bson:"-"`
	UUID     string `json:"uuid" bson:"-"`
	Username string `json:"username" bson:"username"`
	Expire   int64  `json:"expire" bson:"expire"`
}

SessionEntry describes the user session record.

func CopySessionData

func CopySessionData(v SessionEntry) *SessionEntry

CopySessionData returns a copy of the session record.

func NewEmptySession

func NewEmptySession() SessionEntry

NewEmptySession returns a new empty session record.

func (*SessionEntry) GetBSOND

func (v *SessionEntry) GetBSOND() bson.D

GetBSOND Returns Object as BSON.d

type TaskEntry

type TaskEntry struct {
	ObjectID         string `bson:"_id,omitempty" json:"-"`
	ID               string `json:"id" bson:"-"`
	Resource         string `json:"resource" bson:"resource"`
	Name             string `json:"name" bson:"name"`
	Status           string `json:"status" bson:"status"`
	InitiatorID      string `json:"initiatorID" bson:"initiatorID"`
	Date             string `json:"date" bson:"-"`
	Timestamp        int64  `json:"timestamp" bson:"timestamp"`
	Log              string `json:"log,omitempty" bson:"log"`
	OnlyResource     bool   `json:"onlyResource" bson:"onlyResource"`
	Resources        string `json:"resources" bson:"resources"`
	SelectedResource bool   `json:"selectedResource" bson:"selectedResource"`
}

TaskEntry describes a record of the task.

func CopyTaskData

func CopyTaskData(v *TaskEntry) *TaskEntry

CopyTaskData returns a copy of the task record.

func NewEmptyTask

func NewEmptyTask() *TaskEntry

NewEmptyTask returns a new empty task record.

func (*TaskEntry) GetBSOND

func (v *TaskEntry) GetBSOND() bson.D

GetBSOND Returns Object as BSON.d

type UserEntry

type UserEntry struct {
	ObjectID           string `bson:"_id,omitempty" json:"-"`
	ID                 string `json:"id" bson:"-"`
	Username           string `json:"username" bson:"username"`
	Password           string `json:"-" bson:"password"`
	FullName           string `json:"fullName" bson:"fullName"`
	Avatar             string `json:"avatar" bson:"avatar"`
	IsAdmin            bool   `json:"admin" bson:"admin"`
	IsBlocked          bool   `json:"blocked" bson:"blocked"`
	LastLogin          string `json:"lastLogin" bson:"lastLogin"`
	NeedPasswordChange bool   `json:"needPasswordChange" bson:"needPasswordChange"`
	LastSeen           string `json:"lastSeen" bson:"-"`
}

UserEntry describes a user record.

func CopyUserData

func CopyUserData(v UserEntry) *UserEntry

CopyUserData returns a copy of the user's record.

func NewEmptyUser

func NewEmptyUser() UserEntry

NewEmptyUser returns a new empty user record.

func (*UserEntry) GetBSOND

func (v *UserEntry) GetBSOND() bson.D

GetBSOND Returns Object as BSON.d

Jump to

Keyboard shortcuts

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