data

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName         = "orchestrator"
	RemoveModuleAction = "remove_module"
	DeleteUserAction   = "delete_user"
)
View Source
const (
	OrderAscending  = "asc"
	OrderDescending = "desc"
)

Variables

View Source
var ModuleIcon = map[string]string{
	"gitlab":   "https://gist.githack.com/mhrynenko/422743c0c88341f79542a4e381d239f5/raw/13b466475d9096da01f3958f956457b6a4a30498/GitLab_logo.svg",
	"github":   "https://gist.githack.com/mhrynenko/422743c0c88341f79542a4e381d239f5/raw/13b466475d9096da01f3958f956457b6a4a30498/GitHub_logo.svg",
	"telegram": "https://gist.githack.com/mhrynenko/bc7966e91e28ac17dbe809503855e60a/raw/fdbaf990e1f1a1fdc84712af801413b34a709959/Telegram_logo.svg",
	"docker":   "https://gist.githack.com/mhrynenko/422743c0c88341f79542a4e381d239f5/raw/13b466475d9096da01f3958f956457b6a4a30498/DockerHub_logo.svg",
	"click_up": "https://gist.githack.com/mhrynenko/422743c0c88341f79542a4e381d239f5/raw/13b466475d9096da01f3958f956457b6a4a30498/ClickUp_logo.svg",
	"slack":    "https://gist.githack.com/mhrynenko/422743c0c88341f79542a4e381d239f5/raw/13b466475d9096da01f3958f956457b6a4a30498/Slack_logo.svg",
	"mail":     "https://gist.githack.com/mhrynenko/422743c0c88341f79542a4e381d239f5/raw/17bcfd78386a8a438b3abc0739d31c306b0ba33a/DL_logo.svg",
}

Functions

func GetOffsetLinksForPGParams

func GetOffsetLinksForPGParams(r *http.Request, p pgdb.OffsetPageParams) *resources.Links

Types

type DeleteUserPayload

type DeleteUserPayload struct {
	Action   string  `json:"action"`
	Username *string `json:"username"`
	Phone    *string `json:"phone"`
}

type Module

type Module struct {
	Topic    string `json:"topic" structs:"topic" db:"topic"`
	Link     string `json:"link" structs:"link" db:"link"`
	Name     string `json:"name" structs:"name" db:"name"`
	Title    string `json:"title" structs:"title" db:"title"`
	Prefix   string `json:"prefix" structs:"prefix" db:"prefix"`
	IsModule bool   `json:"is_module" structs:"is_module" db:"is_module"`
}

type ModuleQ

type ModuleQ interface {
	New() ModuleQ

	FilterByNames(names ...string) ModuleQ
	FilterByIsModule(isModule bool) ModuleQ

	Get() (*Module, error)
	Select() ([]Module, error)

	Insert(module Module) error
	Delete(name string) error
}

type ModuleRoles

type ModuleRoles struct {
	resources.Key
	Attributes Roles `json:"attributes"`
}

type ModuleRolesResponse

type ModuleRolesResponse struct {
	Data ModuleRoles `json:"data"`
}

type Modules

type Modules map[string]Roles

type ModulesRoles

type ModulesRoles struct {
	resources.Key
	Attributes Modules `json:"attributes"`
}

type ModulesRolesResponse

type ModulesRolesResponse struct {
	Data ModulesRoles `json:"data"`
}

type OrderType

type OrderType string

OrderType - represents sorting order of the query

const (
	// OrderAsc - ascending order
	OrderAsc OrderType = "asc"
	// OrderDesc - descending order
	OrderDesc OrderType = "desc"
)

func (OrderType) Invert

func (o OrderType) Invert() OrderType

Invert - inverts order by

type PermissionsPayload

type PermissionsPayload struct {
	RequestId         string  `json:"request_id"`
	Action            string  `json:"action"`
	ModulePermissions Modules `json:"module_permissions"`
	ModuleName        string  `json:"module_name"`
}

type Request

type Request struct {
	ID          string          `json:"id" db:"id" structs:"id"`
	FromUserID  int64           `json:"from_user_id" db:"from_user_id" structs:"from_user_id,omitempty"`
	ToUserID    int64           `json:"to_user_id" db:"to_user_id" structs:"to_user_id,omitempty"`
	Payload     json.RawMessage `json:"payload" db:"payload" structs:"payload"`
	Status      RequestStatus   `json:"status" db:"status" structs:"status,omitempty"`
	Error       *string         `json:"error,omitempty" db:"error,omitempty" structs:"error,omitempty"`
	Description *string         `json:"description,omitempty" db:"description,omitempty" structs:"description,omitempty"`
	Group       *[]string       `json:"group,omitempty" db:"group,omitempty" structs:"group,omitempty"`
	CreatedAt   string          `json:"created_at" db:"created_at" structs:"created_at,omitempty"`
	Module      *Module         `json:"module,omitempty" structs:"module,omitempty"`
	ModuleName  string          `json:"module_name" db:"module_name" structs:"module_name,omitempty"`
}

type RequestParams

type RequestParams struct {
	Method  string
	Link    string
	Body    []byte
	Query   map[string]string
	Header  map[string]string
	Timeout time.Duration
}

type RequestQ

type RequestQ interface {
	New() RequestQ

	FilterByIDs(ids ...string) RequestQ
	FilterByStatuses(statuses ...RequestStatus) RequestQ
	FilterByFromIds(ids ...int64) RequestQ
	FilterByToIds(ids ...int64) RequestQ
	FilterNotByActions(actions ...string) RequestQ
	JoinsModule() RequestQ

	Get() (*Request, error)
	Select() ([]Request, error)

	Insert(request Request) error
	Update(request Request) error

	SetStatus(status RequestStatus) error
	SetStatusError(status RequestStatus, errorMsg string) error

	Count() RequestQ
	GetTotalCount() (int64, error)

	Page(pageParams pgdb.OffsetPageParams) RequestQ
}

type RequestStatus

type RequestStatus string
const (
	CREATED  RequestStatus = "pending"
	PENDING  RequestStatus = "in progress"
	FINISHED RequestStatus = "success"
	INVITED  RequestStatus = "invited"
	FAILED   RequestStatus = "failed"
)

type RequestTransaction

type RequestTransaction struct {
	ID       string            `json:"id" db:"id" structs:"id"`
	Action   TransactionAction `json:"action" db:"action" structs:"action"`
	Requests json.RawMessage   `json:"requests" db:"requests" structs:"requests"`
}

type RequestTransactions

type RequestTransactions interface {
	New() RequestTransactions

	Get() (*RequestTransaction, error)
	Select() ([]RequestTransaction, error)
	Insert(request RequestTransaction) error
	Update(request RequestTransaction) error
	Delete() error

	FilterByIDs(ids ...string) RequestTransactions
	FilterByRequestID(id string) RequestTransactions
}

type ResponseParams

type ResponseParams struct {
	Body       io.ReadCloser
	Header     http.Header
	StatusCode int
}

type Roles

type Roles map[string]string

type TransactionAction

type TransactionAction string
const (
	Single     TransactionAction = "single"
	DeleteUser TransactionAction = "delete_user"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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