response

package
v0.0.0-...-3fb8480 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorItem

type ErrorItem struct {
	Code    int    `json:"code"`    // Error Code
	Message string `json:"message"` // Error Message
}

type ErrorResult

type ErrorResult struct {
	Error ErrorItem `json:"error"` // Error
}

type HealthCheck

type HealthCheck struct {
	Status    string    `json:"status"`     // Status
	CheckedAt time.Time `json:"checked_at"` // CheckedAt
}

type IDResult

type IDResult struct {
	ID string `json:"id"`
}

func NewIDResult

func NewIDResult(id string) *IDResult

type ListResult

type ListResult struct {
	List       interface{}            `json:"list"`                 // List
	Pagination *pagination.Pagination `json:"pagination,omitempty"` // Pagination
}

type LoginCaptcha

type LoginCaptcha struct {
	CaptchaID string `json:"captcha_id"` // Captcha ID
}

type LoginTokenInfo

type LoginTokenInfo struct {
	AccessToken string `json:"access_token"` // Access Token
	TokenType   string `json:"token_type"`   // Token Type
	ExpiresAt   int64  `json:"expires_at"`   // Expires At
}
type Menu struct {
	ID         string      `json:"id"`                                         // ID
	Name       string      `json:"name" binding:"required"`                    // Name
	Sequence   int         `json:"sequence"`                                   // Sequence
	Icon       string      `json:"icon"`                                       // Icon
	Router     string      `json:"router"`                                     // Router
	ParentID   string      `json:"parent_id"`                                  // Parent ID
	ParentPath string      `json:"parent_path"`                                // Parent Path
	ShowStatus int         `json:"show_status" binding:"required,max=2,min=1"` // Show Status(1:show 2:hide)
	Status     int         `json:"status" binding:"required,max=2,min=1"`      // Menu Status(1:enable 2:disable)
	Memo       string      `json:"memo"`                                       // Memo
	Creator    string      `json:"creator"`                                    // Creator
	CreatedAt  time.Time   `json:"created_at"`                                 // CreatedAt
	UpdatedAt  time.Time   `json:"updated_at"`                                 // UpdatedAt
	Actions    MenuActions `json:"actions"`                                    // Actions
}
func MenuFromDomain(menu *menu.Menu) *Menu
func (a *Menu) String() string
func (a *Menu) ToDomain() *menu.Menu
type MenuAction struct {
	ID        string              `yaml:"-" json:"id"`
	MenuID    string              `yaml:"-" binding:"required" json:"menu_id"`
	Code      string              `yaml:"code" binding:"required" json:"code"`
	Name      string              `yaml:"name" binding:"required" json:"name"`
	Resources MenuActionResources `yaml:"resources,omitempty" json:"resources"`
}
type MenuActionQueryResult struct {
	Data       MenuActions
	PageResult *pagination.Pagination
}
type MenuActionResource struct {
	ID       string `yaml:"-" json:"id"`
	ActionID string `yaml:"-" json:"action_id"`
	Method   string `yaml:"method" binding:"required" json:"method"`
	Path     string `yaml:"path" binding:"required" json:"path"`
}
type MenuActionResourceQueryResult struct {
	Data       MenuActionResources
	PageResult *pagination.Pagination
}
type MenuActionResources []*MenuActionResource
func (a MenuActionResources) ToActionIDMap() map[string]MenuActionResources
type MenuActions []*MenuAction
func (a MenuActions) FillResources(mResources map[string]MenuActionResources)
func (a MenuActions) ToMap() map[string]*MenuAction
func (a MenuActions) ToMenuIDMap() map[string]MenuActions
type MenuQueryResult struct {
	Data       Menus
	PageResult *pagination.Pagination
}
type MenuTree struct {
	ID         string      `yaml:"-" json:"id"`
	Name       string      `yaml:"name" json:"name"`
	Icon       string      `yaml:"icon" json:"icon"`
	Router     string      `yaml:"router,omitempty" json:"router"`
	ParentID   string      `yaml:"-" json:"parent_id"`
	ParentPath string      `yaml:"-" json:"parent_path"`
	Sequence   int         `yaml:"sequence" json:"sequence"`
	ShowStatus int         `yaml:"-" json:"show_status"` // 1:show 2:hide
	Status     int         `yaml:"-" json:"status"`      // 1:enable 2:disable
	Actions    MenuActions `yaml:"actions,omitempty" json:"actions"`
	Children   *MenuTrees  `yaml:"children,omitempty" json:"children,omitempty"`
}
type MenuTrees []*MenuTree
func (a MenuTrees) ToTree() MenuTrees
type Menus []*Menu
func MenusFromDomain(menus menu.Menus) Menus
func (a Menus) FillMenuAction(mActions map[string]MenuActions) Menus
func (a Menus) Len() int
func (a Menus) Less(i, j int) bool
func (a Menus) SplitParentIDs() []string
func (a Menus) Swap(i, j int)
func (a Menus) ToMap() map[string]*Menu
func (a Menus) ToTree() MenuTrees

type Role

type Role struct {
	ID        string    `json:"id"`         // ID
	Name      string    `json:"name"`       // Name
	Sequence  int       `json:"sequence"`   // Sequence
	Memo      string    `json:"memo"`       // Memo
	Status    int       `json:"status"`     // Status(1:enable 2:disable)
	Creator   string    `json:"creator"`    // Creator
	CreatedAt time.Time `json:"created_at"` // CreatedAt
	UpdatedAt time.Time `json:"updated_at"` // UpdatedAt
	RoleMenus RoleMenus `json:"role_menus"` // RoleMenus
}

func RoleFromDomain

func RoleFromDomain(role *role.Role) *Role

type RoleMenu

type RoleMenu struct {
	ID       string `json:"id"`                           // ID
	RoleID   string `json:"role_id" binding:"required"`   // Role ID
	MenuID   string `json:"menu_id" binding:"required"`   // Menu ID
	ActionID string `json:"action_id" binding:"required"` // Action ID
}

type RoleMenuQueryResult

type RoleMenuQueryResult struct {
	Data       RoleMenus
	PageResult *pagination.Pagination
}

type RoleMenus

type RoleMenus []*RoleMenu

func (RoleMenus) ToActionIDs

func (a RoleMenus) ToActionIDs() []string

func (RoleMenus) ToMap

func (a RoleMenus) ToMap() map[string]*RoleMenu

func (RoleMenus) ToMenuIDs

func (a RoleMenus) ToMenuIDs() []string

func (RoleMenus) ToRoleIDMap

func (a RoleMenus) ToRoleIDMap() map[string]RoleMenus

type RoleQueryResult

type RoleQueryResult struct {
	Data       Roles
	PageResult *pagination.Pagination
}

type Roles

type Roles []*Role

func RolesFromDomain

func RolesFromDomain(roles role.Roles) Roles

func (Roles) ToMap

func (a Roles) ToMap() map[string]*Role

func (Roles) ToNames

func (a Roles) ToNames() []string

type StatusResult

type StatusResult struct {
	Status StatusText `json:"status"` // Result status
}

type StatusText

type StatusText string
const (
	OKStatus    StatusText = "OK"
	ErrorStatus StatusText = "ERROR"
	FailStatus  StatusText = "FAIL"
)

func (StatusText) String

func (t StatusText) String() string

type User

type User struct {
	ID        string    `json:"id"`                                    // ID
	UserName  string    `json:"user_name" binding:"required"`          // User Name
	RealName  string    `json:"real_name" binding:"required"`          // Real Name
	Password  string    `json:"password"`                              // Password
	Phone     string    `json:"phone"`                                 // Phone
	Email     string    `json:"email"`                                 // Email
	Status    int       `json:"status" binding:"required,max=2,min=1"` // Status(1:enable 2:disable)
	Creator   string    `json:"creator"`                               // Creator
	CreatedAt time.Time `json:"created_at"`                            // CreatedAt
	UserRoles UserRoles `json:"user_roles" binding:"required,gt=0"`    // UserRoles
}

func UserFromDomain

func UserFromDomain(user *user.User) *User

func (*User) CleanSecure

func (a *User) CleanSecure() *User

func (*User) String

func (a *User) String() string

type UserLoginInfo

type UserLoginInfo struct {
	UserID   string `json:"user_id"`   // User ID
	UserName string `json:"user_name"` // User Name
	RealName string `json:"real_name"` // Real Name
	Roles    Roles  `json:"roles"`     // Role
}

type UserQueryResult

type UserQueryResult struct {
	Data       Users
	PageResult *pagination.Pagination
}

func (UserQueryResult) ToShowResult

func (a UserQueryResult) ToShowResult(mUserRoles map[string]UserRoles, mRoles map[string]*Role) *UserShowQueryResult

type UserRole

type UserRole struct {
	ID     string `json:"id"`      // ID
	UserID string `json:"user_id"` // User ID
	RoleID string `json:"role_id"` // Role ID
}

type UserRoleQueryResult

type UserRoleQueryResult struct {
	Data       UserRoles
	PageResult *pagination.Pagination
}

type UserRoles

type UserRoles []*UserRole

func (UserRoles) ToMap

func (a UserRoles) ToMap() map[string]*UserRole

func (UserRoles) ToRoleIDs

func (a UserRoles) ToRoleIDs() []string

func (UserRoles) ToUserIDMap

func (a UserRoles) ToUserIDMap() map[string]UserRoles

type UserShow

type UserShow struct {
	ID        string    `json:"id"`         // ID
	UserName  string    `json:"user_name"`  // User Name
	RealName  string    `json:"real_name"`  // Real Name
	Phone     string    `json:"phone"`      // Phone
	Email     string    `json:"email"`      // Email
	Status    int       `json:"status"`     // Status(1:enable 2:disable)
	CreatedAt time.Time `json:"created_at"` // CreatedAt
	Roles     []*Role   `json:"roles"`      // Roles
}

type UserShowQueryResult

type UserShowQueryResult struct {
	Data       UserShows
	PageResult *pagination.Pagination
}

type UserShows

type UserShows []*UserShow

type Users

type Users []*User

func UsersFromDomain

func UsersFromDomain(users user.Users) Users

func (Users) ToIDs

func (a Users) ToIDs() []string

func (Users) ToUserShows

func (a Users) ToUserShows(mUserRoles map[string]UserRoles, mRoles map[string]*Role) UserShows

Jump to

Keyboard shortcuts

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