53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
package models
|
|
|
|
import (
|
|
"database/sql"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
_ "github.com/jackc/pgx/v5/stdlib"
|
|
)
|
|
|
|
type Angler struct {
|
|
ID uuid.UUID `db:"angler_id" json:"id"`
|
|
Username string `db:"angler_username" json:"name"`
|
|
Email *string `db:"angler_email" json:"email"`
|
|
}
|
|
|
|
type SSHKey struct {
|
|
ID uuid.UUID `db:"key_id" json:"id"`
|
|
SSH_Type string `db:"key_type" json:"ssh_type"`
|
|
Date []byte `db:"key_data" json:"data"`
|
|
Fingerprint string `db:"key_fingerprint" json:"fingerprint"`
|
|
}
|
|
|
|
type AnglerDB struct {
|
|
Angler
|
|
PasswordHash string `db:"angler_password"`
|
|
}
|
|
|
|
type Fish struct {
|
|
ID uuid.UUID `db:"fish_id" json:"id"`
|
|
Name string `db:"fish_name" json:"name"`
|
|
Description string `db:"fish_desc" json:"desc"`
|
|
SizeOZMax uint16 `db:"fish_size_oz_max" json:"size_oz_max"`
|
|
SizeOZMin uint16 `db:"fish_size_oz_maxin" json:"size_oz_min"`
|
|
}
|
|
|
|
type Catch struct {
|
|
ID uuid.UUID `db:"catch_id" json:"id"`
|
|
At time.Time `db:"catch_caught_at" json:"caught_at"`
|
|
AnglerID uuid.UUID `db:"angler_id" json:"angler_id"`
|
|
FishID uuid.UUID `db:"fish_id" json:"fish_id"`
|
|
SizeOZ uint16 `db:"catch_size_oz" json:"size_oz"`
|
|
}
|
|
|
|
type Cast struct {
|
|
ID uuid.UUID `db:"cast_id" json:"id"`
|
|
Start time.Time `db:"cast_started_at" json:"start"`
|
|
End sql.NullTime `db:"cast_ended_at" json:"end"`
|
|
AnglerID uuid.UUID `db:"angler_id" json:"angler_id"`
|
|
CatchID uuid.NullUUID `db:"catch_id" json:"catch_id"`
|
|
}
|