dal

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGroupPath

func GetGroupPath(tx *sql.Tx, gid wa.ID) ([]byte, error)

GetGroupPath returns the group path.

func NewDB

func NewDB(ctx context.Context, wg *sync.WaitGroup, config *wa.Config, logger *log.Logger) (*sql.DB, error)

NewDB creates a new database.

Types

type ClaimDAO

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

ClaimDAO represents the claim DAO.

func NewClaimDAO

func NewClaimDAO(config *wa.Config, db *sql.DB) (*ClaimDAO, error)

NewClaimDAO creates a new claim DAO.

func (*ClaimDAO) Get

func (a *ClaimDAO) Get(uid wa.ID, key string) (string, error)

Get gets the claim.

func (*ClaimDAO) GetKeys

func (a *ClaimDAO) GetKeys() (keys []string, err error)

GetKeys gets the claim keys.

func (*ClaimDAO) Query

func (a *ClaimDAO) Query(uid wa.ID) (claims []wa.Item[string, string], err error)

Query queries the claims.

func (*ClaimDAO) Set

func (a *ClaimDAO) Set(uid wa.ID, key string, value string) error

Set sets the claim.

type GroupDAO

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

GroupDAO represents the group DAO.

func NewGroupDAO

func NewGroupDAO(db *sql.DB) (*GroupDAO, error)

NewGroupDAO creates a new group DAO.

func (*GroupDAO) CheckGroup

func (a *GroupDAO) CheckGroup(pid, gid wa.ID) error

CheckGroup checks the group.

func (*GroupDAO) Create

func (a *GroupDAO) Create(group *wa.Group) (*wa.Group, error)

Create creates a new group.

func (*GroupDAO) Delete

func (a *GroupDAO) Delete(gid wa.ID) error

Delete deletes the group.

func (*GroupDAO) Find

func (a *GroupDAO) Find(code string) (*wa.Group, error)

Find finds the group by code.

func (*GroupDAO) Get

func (a *GroupDAO) Get(gid wa.ID) (*wa.Group, error)

Get gets the group by id.

func (*GroupDAO) Query

func (a *GroupDAO) Query(gid wa.ID, keyword string) (groups []*wa.Group, err error)

Query queries the groups by keyword.

func (*GroupDAO) Update

func (a *GroupDAO) Update(group *wa.Group) (*wa.Group, error)

Update updates the group.

type UserDAO

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

UserDAO represents the user DAO.

func NewUserDAO

func NewUserDAO(config *wa.Config, db *sql.DB) (*UserDAO, error)

NewUserDAO creates a new user DAO.

func (*UserDAO) Create

func (a *UserDAO) Create(user *wa.User) (*wa.User, error)

Create creates a new user.

func (*UserDAO) Delete

func (a *UserDAO) Delete(uid wa.ID) error

Delete deletes the user.

func (*UserDAO) Find

func (a *UserDAO) Find(code string) (*wa.User, error)

Find finds the user by code.

func (*UserDAO) Get

func (a *UserDAO) Get(uid wa.ID) (*wa.User, error)

Get gets the user by id.

func (*UserDAO) GetAuthToken

func (a *UserDAO) GetAuthToken(uid wa.ID) (token []byte, err error)

GetAuthToken gets the user auth token.

func (*UserDAO) GetSessionToken

func (a *UserDAO) GetSessionToken(uid wa.ID) (token []byte, err error)

GetSessionToken gets the user session token.

func (*UserDAO) Query

func (a *UserDAO) Query(gid wa.ID, key string, value string, keyword string) (users []*wa.User, err error)

Query queries the users by keyword.

func (*UserDAO) SetAuthToken

func (a *UserDAO) SetAuthToken(uid wa.ID, token []byte) error

SetAuthToken sets the user auth token.

func (*UserDAO) SetSessionToken

func (a *UserDAO) SetSessionToken(uid wa.ID, token []byte) error

SetSessionToken sets the user session token.

func (*UserDAO) Update

func (a *UserDAO) Update(user *wa.User) (*wa.User, error)

Update updates the user.

Jump to

Keyboard shortcuts

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