json

package
v0.0.0-...-20ecdb9 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client of json database.

func GetClient

func GetClient(path string) (cli *Client, err error)

GetClient of json database.

func (*Client) CheckGroup

func (c *Client) CheckGroup(id string) bool

CheckGroup tell if the given group is enabled.

func (*Client) CheckPermission

func (c *Client) CheckPermission(id string) (level int, groups []string)

CheckPermission return the permission level of given user.

func (*Client) GetAdmin

func (c *Client) GetAdmin(id string) (admin *role.Admin)

GetAdmin return the admin client of given id.

func (*Client) GetAdminList

func (c *Client) GetAdminList() (list []*role.Admin)

GetAdminList return the list of admins.

func (*Client) GetAdminListbyGroupID

func (c *Client) GetAdminListbyGroupID(id string) (list []*role.Admin)

GetAdminListbyGroupID return the list of admins of the given group.

func (*Client) GetGroup

func (c *Client) GetGroup(id string) (group *group.Group)

GetGroup return the group client of given id.

func (*Client) GetGroupList

func (c *Client) GetGroupList() []*group.Group

GetGroupList return the list of groups registered in database.

func (*Client) GetUpdateNotifyChan

func (c *Client) GetUpdateNotifyChan() <-chan struct{}

GetUpdateNotifyChan return a read-only channel that will signal when database is updated.

func (*Client) GetUser

func (c *Client) GetUser(id string) (user *role.User)

GetUser return the user client of given id.

func (*Client) GetUserList

func (c *Client) GetUserList() (list []*role.User)

GetUserList return the list of users.

func (*Client) GetUserListbyGroupID

func (c *Client) GetUserListbyGroupID(id string) (list []*role.User)

GetUserListbyGroupID return the list of users registered for the given group.

func (*Client) PutAdmin

func (c *Client) PutAdmin(a ...*role.Admin) error

PutAdmin insert a new admin to database.

func (*Client) PutGroup

func (c *Client) PutGroup(g ...*group.Group) error

PutGroup insert a new group to database.

func (*Client) PutUser

func (c *Client) PutUser(u ...*role.User) error

PutUser insert a new user to database.

func (*Client) Reload

func (c *Client) Reload() (err error)

Reload refresh the cache of json database.

func (*Client) UpdateAdmin

func (c *Client) UpdateAdmin(a ...*role.Admin) error

UpdateAdmin updates given admin.

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(g ...*group.Group) error

UpdateGroup updates given group.

func (*Client) UpdateUser

func (c *Client) UpdateUser(u ...*role.User) error

UpdateUser updates given user.

type ErrMap

type ErrMap map[int]string

ErrMap stores error message of multi-operation function.

func (*ErrMap) Error

func (e *ErrMap) Error() string

Jump to

Keyboard shortcuts

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