Documentation ¶
Overview ¶
Package db contains project user related CRUD functionality.
Index ¶
- type ProjectUser
- type Store
- func (s Store) Create(ctx context.Context, projectUser ProjectUser) error
- func (s Store) Delete(ctx context.Context, projectUserID string) error
- func (s Store) QueryByID(ctx context.Context, projectUserID string) (ProjectUser, error)
- func (s Store) QueryWorkspaceProjectUsers(ctx context.Context, WorkspaceID string, pageNumber, rowsPerPage int) ([]ProjectUser, error)
- func (s Store) Tran(tx sqlx.ExtContext) Store
- func (s Store) Update(ctx context.Context, projectUser ProjectUser) error
- func (s Store) WithinTran(ctx context.Context, fn func(sqlx.ExtContext) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProjectUser ¶
type ProjectUser struct { ID string `db:"project_user_id"` Pid string `db:"pid"` Uid string `db:"uid"` Wid string `db:"wid"` Manager bool `db:"manager"` Rate float64 `db:"rate"` DateCreated time.Time `db:"date_created"` DateUpdated time.Time `db:"date_updated"` }
ProjectUser represent the structure we need for moving data between the app and the database.
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) Create ¶
func (s Store) Create(ctx context.Context, projectUser ProjectUser) error
Create inserts a new projectUser into the database.
func (Store) QueryWorkspaceProjectUsers ¶
func (s Store) QueryWorkspaceProjectUsers(ctx context.Context, WorkspaceID string, pageNumber, rowsPerPage int) ([]ProjectUser, error)
QueryWorkspaceProjectUsers retrieves a list of existing project 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, projectUser ProjectUser) error
Update replaces a project user document in the database.
func (Store) WithinTran ¶
WithinTran runs passed function and do commit/rollback at the end.
Click to show internal directories.
Click to hide internal directories.