Documentation
¶
Index ¶
- type Store
- func (s Store) Create(ctx context.Context, workspace Workspace) error
- func (s Store) Query(ctx context.Context, userID string, pageNumber int, rowsPerPage int) ([]Workspace, error)
- func (s Store) QueryByID(ctx context.Context, workspaceID string) (Workspace, error)
- func (s Store) Tran(tx sqlx.ExtContext) Store
- func (s Store) Update(ctx context.Context, workspace Workspace) error
- func (s Store) WithinTran(ctx context.Context, fn func(sqlx.ExtContext) error) error
- type Workspace
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) Query ¶
func (s Store) Query(ctx context.Context, userID string, pageNumber int, rowsPerPage int) ([]Workspace, error)
Query retrieves a list of existing workspaces from the database.
func (Store) Tran ¶
func (s Store) Tran(tx sqlx.ExtContext) Store
Tran return new Store with transaction in it.
func (Store) WithinTran ¶
WithinTran runs passed function and do commit/rollback at the end.
type Workspace ¶
type Workspace struct {
ID string `db:"workspace_id"`
Name string `db:"name"`
Uid string `db:"uid"`
DefaultHourlyRate float32 `db:"default_hourly_rate"`
DefaultCurrency string `db:"default_currency"`
OnlyAdminMayCreateProjects bool `db:"only_admin_may_create_projects"`
OnlyAdminSeeBillableRates bool `db:"only_admin_see_billable_rates"`
OnlyAdminSeeTeamDashboard bool `db:"only_admin_see_team_dashboard"`
Rounding int `db:"rounding"`
RoundingMinutes int `db:"rounding_minutes"`
DateCreated time.Time `db:"date_created"`
DateUpdated time.Time `db:"date_updated"`
LogoURL string `db:"logo_url"`
}
Workspace represent the structure we need for moving data between the app and the database.
Click to show internal directories.
Click to hide internal directories.