Documentation
¶
Index ¶
- Variables
- func Migrate(db *sql.DB, dir string) error
- func MigrateFS(db *sql.DB, migrationFS fs.FS, dir string) error
- func Open() (*sql.DB, error)
- type PostgresTokenStore
- type PostgresUserStore
- type PostgresWorkoutStore
- func (pg *PostgresWorkoutStore) CreateWorkout(workout *Workout) (*Workout, error)
- func (pg *PostgresWorkoutStore) DeleteWorkout(id int64) error
- func (pg *PostgresWorkoutStore) GetWorkoutByID(id int64) (*Workout, error)
- func (pg *PostgresWorkoutStore) GetWorkoutOwner(workoutID int64) (int, error)
- func (pg *PostgresWorkoutStore) UpdateWorkout(workout *Workout) error
- type TokenStore
- type User
- type UserStore
- type Workout
- type WorkoutEntry
- type WorkoutStore
Constants ¶
This section is empty.
Variables ¶
View Source
var AnonymousUser = &User{}
Functions ¶
Types ¶
type PostgresTokenStore ¶
type PostgresTokenStore struct {
// contains filtered or unexported fields
}
func NewPostgresTokenStore ¶
func NewPostgresTokenStore(db *sql.DB) *PostgresTokenStore
func (*PostgresTokenStore) CreateNewToken ¶
func (*PostgresTokenStore) DeleteAllTokensForUser ¶
func (t *PostgresTokenStore) DeleteAllTokensForUser(userID int, scope string) error
type PostgresUserStore ¶
type PostgresUserStore struct {
// contains filtered or unexported fields
}
func NewPostgresUserStore ¶
func NewPostgresUserStore(db *sql.DB) *PostgresUserStore
func (*PostgresUserStore) CreateUser ¶
func (s *PostgresUserStore) CreateUser(u *User) error
func (*PostgresUserStore) GetUserByUsername ¶
func (s *PostgresUserStore) GetUserByUsername(uname string) (*User, error)
func (*PostgresUserStore) GetUserToken ¶
func (s *PostgresUserStore) GetUserToken(scope, plainTextPassword string) (*User, error)
func (*PostgresUserStore) UpdateUser ¶
func (s *PostgresUserStore) UpdateUser(u *User) error
type PostgresWorkoutStore ¶
type PostgresWorkoutStore struct {
// contains filtered or unexported fields
}
func NewPostgresWorkoutStore ¶
func NewPostgresWorkoutStore(db *sql.DB) *PostgresWorkoutStore
func (*PostgresWorkoutStore) CreateWorkout ¶
func (pg *PostgresWorkoutStore) CreateWorkout(workout *Workout) (*Workout, error)
func (*PostgresWorkoutStore) DeleteWorkout ¶
func (pg *PostgresWorkoutStore) DeleteWorkout(id int64) error
func (*PostgresWorkoutStore) GetWorkoutByID ¶
func (pg *PostgresWorkoutStore) GetWorkoutByID(id int64) (*Workout, error)
func (*PostgresWorkoutStore) GetWorkoutOwner ¶
func (pg *PostgresWorkoutStore) GetWorkoutOwner(workoutID int64) (int, error)
func (*PostgresWorkoutStore) UpdateWorkout ¶
func (pg *PostgresWorkoutStore) UpdateWorkout(workout *Workout) error
type TokenStore ¶
type User ¶
type User struct {
ID int `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
PasswordHash password `json:"_"`
Bio string `json:"bio"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (*User) IsAnonymous ¶
type WorkoutEntry ¶
Click to show internal directories.
Click to hide internal directories.