models

package
v0.0.0-...-5c62cfe Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionTypeAPI        = "api"
	ActionTypeMenu       = "menu"
	ActionTypePageAction = "action"
)
View Source
const (
	ObjectTypeResource      = "res"
	ObjectTypeResourceGroup = "group"
	ObjectTypeAction        = "act"
)

Variables

This section is empty.

Functions

func ObjRepr

func ObjRepr(o Object) string

Types

type Action

type Action struct {
	Code string `gorm:"size:32;primaryKey"`
	Type string `gorm:"size:8;not null"`
	Name string `gorm:"size:64"`
}

Action represents an operation that can be performed on UI layer or API layer.

func (*Action) ObjectID

func (a *Action) ObjectID() string

func (*Action) ObjectType

func (a *Action) ObjectType() string

func (*Action) String

func (a *Action) String() string

type Endpoint

type Endpoint struct {
	ID         uint
	TargetType string `gorm:"size:8"`
	Method     string `gorm:"size:8"`
	Path       string `gorm:"size:256"`
	ApiCode    string `gorm:"size:64;index"`
	Action     Action `gorm:"foreignkey:ApiCode;references:Code"`
}

Endpoint represents a real API via HTTP, WS or some other protocols. It will be mapped to an API action.

type MenuItem struct {
	ID         uint
	Code       string `gorm:"size:32;index"`
	ParentCode string `gorm:"size:32;index"`
	Platform   string `gorm:"size:8"`
}

MenuItem represents a navigation menu or a page action on UI, organized in a tree style.

type Object

type Object interface {
	ObjectType() string
	ObjectID() string
	String() string
}

type Role

type Role struct {
	// role id
	ID uint `gorm:"primarykey"`

	// role name, e.g. "admin or 123456"
	Name string ` gorm:"index"`

	// role status
	Status string

	// org id,
	OrgId string `gorm:"index"`

	// role display name, e.g. "administrators"
	DisplayName string
}

Jump to

Keyboard shortcuts

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