Documentation ¶
Overview ¶
Package db contains client related CRUD functionality.
Index ¶
- type Store
- func (s Store) Delete(ctx context.Context, workspaceUserID string) error
- func (s Store) Invite(ctx context.Context, workspaceUser WorkspaceUser) error
- func (s Store) Query(ctx context.Context, workspaceID string, pageNumber int, rowsPerPage int) ([]WorkspaceUser, error)
- func (s Store) QueryByID(ctx context.Context, workspaceUserID string) (WorkspaceUser, error)
- func (s Store) QueryByuIDwID(ctx context.Context, workspaceID, userID string) (WorkspaceUser, error)
- func (s Store) Tran(tx sqlx.ExtContext) Store
- func (s Store) Update(ctx context.Context, workspaceUser WorkspaceUser) error
- func (s Store) WithinTran(ctx context.Context, fn func(sqlx.ExtContext) error) error
- type WorkspaceUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages the set of APIs for user access.
func NewStore ¶
func NewStore(log *zap.SugaredLogger, db *sqlx.DB) Store
NewStore constructs a data for api access.
func (Store) Invite ¶
func (s Store) Invite(ctx context.Context, workspaceUser WorkspaceUser) error
Invite creates new invitation.
func (Store) Query ¶
func (s Store) Query(ctx context.Context, workspaceID string, pageNumber int, rowsPerPage int) ([]WorkspaceUser, error)
Query retrieves a list of existing workspace users from the database.
func (Store) QueryByuIDwID ¶
func (s Store) QueryByuIDwID(ctx context.Context, workspaceID, userID string) (WorkspaceUser, error)
QueryByuIDwID gets the specified workspace user from the database.
func (Store) Tran ¶
func (s Store) Tran(tx sqlx.ExtContext) Store
Tran return new Store with transaction in it.
func (Store) Update ¶
func (s Store) Update(ctx context.Context, workspaceUser WorkspaceUser) error
Update replaces a workspace user document in the database.
func (Store) WithinTran ¶
WithinTran runs passed function and do commit/rollback at the end.
type WorkspaceUser ¶
type WorkspaceUser struct { ID string `db:"workspace_user_id"` Uid string `db:"uid"` Wid string `db:"wid"` Admin bool `db:"admin"` Active bool `db:"active"` InviteKey string `db:"invite_key"` DateCreated time.Time `db:"date_created"` DateUpdated time.Time `db:"date_updated"` }
WorkspaceUser represent the structure we need for moving data between the app and the database.
Click to show internal directories.
Click to hide internal directories.