db

package
v0.0.0-...-8a9e68d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteUser

type CompleteUser struct {
	Email    string   `json:"email"`
	Tracker  string   `json:"tracker_name"`
	Symptoms []string `json:"symptoms"`
}

type DBClientData

type DBClientData struct {
	AwsRegion   string
	DbName      string
	DbUser      string
	RdsEndpoint string
}

type Database

type Database struct {
	// contains filtered or unexported fields
}

NOTE: Database holds the database connection pool.

func New

func New() (*Database, error)

NOTE: New initializes a new Database connection.

func (*Database) Close

func (d *Database) Close() error

NOTE: Close closes the database connection.

func (*Database) CreateSymptom

func (d *Database) CreateSymptom(symptom string, trackerID int) error

func (*Database) CreateSymptomLog

func (d *Database) CreateSymptomLog(symptomLog SymptomLogRequestBody) error

func (*Database) CreateTracker

func (d *Database) CreateTracker(tracker string, userID int) error

func (*Database) CreateUser

func (d *Database) CreateUser(email, sub string) error

func (*Database) GetSymptomLogByTrackerIDAndCurrentTime

func (d *Database) GetSymptomLogByTrackerIDAndCurrentTime(trackerID int) (SymptomLog, error)

func (*Database) GetSymptomLogsByTrackerID

func (d *Database) GetSymptomLogsByTrackerID(trackerID int) ([]SymptomLog, error)

func (*Database) GetSymptomLogsByUserID

func (d *Database) GetSymptomLogsByUserID(userID int) ([]SymptomLog, error)

func (*Database) GetSymptomsByTrackerID

func (d *Database) GetSymptomsByTrackerID(trackerID int) ([]Symptom, error)

func (*Database) GetTrackerByNameAndUserID

func (d *Database) GetTrackerByNameAndUserID(trackerName string, userID int) (Tracker, error)

func (*Database) GetTrackerByUserID

func (d *Database) GetTrackerByUserID(userID int) ([]Tracker, error)

func (*Database) GetUserBySub

func (d *Database) GetUserBySub(cognitoSub string) (User, error)

type NewTrackerRequestBody

type NewTrackerRequestBody struct {
	TrackerName string   `json:"tracker_name"`
	Symptoms    []string `json:"symptoms"`
	UserID      int      `json:"user_id"`
}

type Symptom

type Symptom struct {
	ID          int    `json:"id"`
	TrackerID   int    `json:"tracker_id"`
	SymptomName string `json:"symptom_name"`
}

type SymptomLog

type SymptomLog struct {
	ID        int    `json:"id"`
	UserID    int    `json:"user_id"`
	TrackerID int    `json:"tracker_id"`
	LogTime   string `json:"log_time"`
	Severity  string `json:"severity"`
	Symptoms  string `json:"symptoms"`
	Notes     string `json:"notes"`
}

type SymptomLogRequestBody

type SymptomLogRequestBody struct {
	TrackerName      string `json:"tracker_name"`
	SelectedSymptoms string `json:"selected_symptoms"`
	Severity         string `json:"severity"`
	Notes            string `json:"notes"`
	UserID           int    `json:"user_id"`
	TrackerID        int    `json:"tracker_id"`
}

type Tracker

type Tracker struct {
	ID          int    `json:"id"`
	UserID      int    `json:"user_id"`
	TrackerName string `json:"tracker_name"`
}

type User

type User struct {
	ID         int    `json:"id"`
	CognitoSub string `json:"cognito_sub"`
	Email      string `json:"email"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL