Documentation
¶
Index ¶
- func HashPassword(plaintextPassword string) (string, error)
- func Matches(plaintextPassword, hashedPassword string) (bool, error)
- func NewDatabasePool(ctx context.Context, cfg *config.Conf) (*pgxpool.Pool, error)
- type CreateTeamParams
- type CreateTeamRow
- type CreateUserWithNewTeamParams
- type CreateUserWithNewTeamRow
- type DBTX
- type GetUserByIDParams
- type GetUserByIDRow
- type ListUsersParams
- type ListUsersRow
- type NullUserRole
- type PersonalAccessTokens
- type Queries
- func (q *Queries) CountUsers(ctx context.Context, teamID pgtype.Text) (int64, error)
- func (q *Queries) CreateTeam(ctx context.Context, arg CreateTeamParams) (CreateTeamRow, error)
- func (q *Queries) CreateUserWithNewTeam(ctx context.Context, arg CreateUserWithNewTeamParams) (CreateUserWithNewTeamRow, error)
- func (q *Queries) DoesAdminExist(ctx context.Context) (bool, error)
- func (q *Queries) GetUserByID(ctx context.Context, arg GetUserByIDParams) (GetUserByIDRow, error)
- func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]ListUsersRow, error)
- func (q *Queries) RetrieveUserWithTeamInfoByAPIKEY(ctx context.Context, token string) (RetrieveUserWithTeamInfoByAPIKEYRow, error)
- func (q *Queries) UpdateUserRole(ctx context.Context, arg UpdateUserRoleParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RetrieveUserWithTeamInfoByAPIKEYRow
- type TeamUser
- type Teams
- type UpdateUserRoleParams
- type UserRole
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶ added in v0.0.3
HashPassword will take a string and return a string copy of a bcrypt hashed password.
Types ¶
type CreateTeamParams ¶ added in v0.0.3
type CreateTeamRow ¶ added in v0.0.3
type CreateUserWithNewTeamParams ¶ added in v0.0.3
type CreateUserWithNewTeamRow ¶ added in v0.0.3
type GetUserByIDParams ¶ added in v0.0.3
type GetUserByIDRow ¶ added in v0.0.3
type GetUserByIDRow struct {
Uuid string `json:"uuid"`
Name pgtype.Text `json:"name"`
Email pgtype.Text `json:"email"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
Role UserRole `json:"role"`
}
type ListUsersParams ¶ added in v0.0.3
type ListUsersRow ¶ added in v0.0.3
type ListUsersRow struct {
ID int32 `json:"id"`
Name pgtype.Text `json:"name"`
Email pgtype.Text `json:"email"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
Role UserRole `json:"role"`
}
type NullUserRole ¶ added in v0.0.3
type NullUserRole struct {
UserRole UserRole `json:"user_role"`
Valid bool `json:"valid"` // Valid is true if UserRole is not NULL
}
func (*NullUserRole) Scan ¶ added in v0.0.3
func (ns *NullUserRole) Scan(value interface{}) error
Scan implements the Scanner interface.
type PersonalAccessTokens ¶ added in v0.0.3
type PersonalAccessTokens struct {
ID int64 `json:"id"`
TokenableType string `json:"tokenable_type"`
TokenableID string `json:"tokenable_id"`
Name string `json:"name"`
Token string `json:"token"`
Abilities pgtype.Text `json:"abilities"`
LastUsedAt pgtype.Timestamptz `json:"last_used_at"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CountUsers ¶ added in v0.0.3
$2 is the UUID of the authenticated user Count all users the authorized user can see; used in pagination
func (*Queries) CreateTeam ¶ added in v0.0.3
func (q *Queries) CreateTeam(ctx context.Context, arg CreateTeamParams) (CreateTeamRow, error)
Create a new team. Can only be created by a user with admin privileges
func (*Queries) CreateUserWithNewTeam ¶ added in v0.0.3
func (q *Queries) CreateUserWithNewTeam(ctx context.Context, arg CreateUserWithNewTeamParams) (CreateUserWithNewTeamRow, error)
Create a new user and a team for them. This is only done once when a user is registered. All other team creation is done via CreateTeam and users must be manually invited into the new team.
func (*Queries) DoesAdminExist ¶ added in v0.0.3
Create admin user (for initial setup only)
func (*Queries) GetUserByID ¶ added in v0.0.3
func (q *Queries) GetUserByID(ctx context.Context, arg GetUserByIDParams) (GetUserByIDRow, error)
Get users in the same team mapping as the logged-in user when provided another user's ID
func (*Queries) ListUsers ¶ added in v0.0.3
func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]ListUsersRow, error)
List all users associated with the authorized user and get the total count
func (*Queries) RetrieveUserWithTeamInfoByAPIKEY ¶ added in v0.0.3
func (*Queries) UpdateUserRole ¶ added in v0.0.3
func (q *Queries) UpdateUserRole(ctx context.Context, arg UpdateUserRoleParams) error
Update a user role
type RetrieveUserWithTeamInfoByAPIKEYRow ¶ added in v0.0.3
type TeamUser ¶ added in v0.0.3
type TeamUser struct {
ID int32 `json:"id"`
TeamID pgtype.Text `json:"team_id"`
UserID pgtype.Text `json:"user_id"`
Role UserRole `json:"role"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type Teams ¶ added in v0.0.3
type Teams struct {
ID int32 `json:"id"`
Uuid string `json:"uuid"`
PersonalTeam pgtype.Bool `json:"personal_team"`
Name string `json:"name"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type UpdateUserRoleParams ¶ added in v0.0.3
type Users ¶ added in v0.0.3
type Users struct {
ID int32 `json:"id"`
Uuid string `json:"uuid"`
Name pgtype.Text `json:"name"`
Email pgtype.Text `json:"email"`
EmailVerifiedAt pgtype.Timestamptz `json:"email_verified_at"`
Password pgtype.Text `json:"password"`
RememberToken pgtype.Text `json:"remember_token"`
CurrentTeamID pgtype.Int4 `json:"current_team_id"`
ProfilePhotoPath pgtype.Text `json:"profile_photo_path"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}