Documentation ¶
Index ¶
- type Database
- func (d *Database) BeginTransaction() *gorm.DB
- func (d *Database) CreateComponent(dashboard *models.Dashboard, name string, cType models.ComponentType, ...) (*models.Component, error)
- func (d *Database) CreateDashboard(name string) (*models.Dashboard, error)
- func (d *Database) DeleteComponent(component *models.Component) error
- func (d *Database) DeleteDashboard(dashboard *models.Dashboard) error
- func (d *Database) GetActivity(id string) (*models.Activity, error)
- func (d *Database) GetAthlete(id string) (*models.Athlete, error)
- func (d *Database) GetComponent(dashboardID, componentID uint) (*models.Component, error)
- func (d *Database) GetConnection() *gorm.DB
- func (d *Database) GetCurrentConfig() (*models.Config, error)
- func (d *Database) GetDashboard(dashboardID uint) (*models.Dashboard, error)
- func (d *Database) GetGear(id string) (*models.Gear, error)
- func (d *Database) GetLatestActivity() (*models.Activity, error)
- func (d *Database) GetModelsSchema() ([]Schema, error)
- func (d *Database) ListActivities(offset, limit int) (int64, []models.Activity, error)
- func (d *Database) ListAthletes(offset, limit int) (int64, []models.Athlete, error)
- func (d *Database) ListComponents(dashboardId uint) ([]models.Component, error)
- func (d *Database) ListDashboards(offset, limit int) (int64, []models.Dashboard, error)
- func (d *Database) ListGears(offset, limit int) (int64, []models.Gear, error)
- func (d *Database) Migrate() error
- func (d *Database) RunQuery(query string) ([]map[string]interface{}, error)
- func (d *Database) UpdateComponent(component *models.Component) error
- func (d *Database) UpdateDashboard(dashboard *models.Dashboard) error
- func (d *Database) UpsertActivities(tx *gorm.DB, activities []models.Activity) error
- func (d *Database) UpsertAthlete(tx *gorm.DB, athlete *models.Athlete) error
- func (d *Database) UpsertConfig(in models.Config) (*models.Config, error)
- func (d *Database) UpsertGears(tx *gorm.DB, gears []models.Gear) error
- type Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
func (*Database) BeginTransaction ¶
func (*Database) CreateComponent ¶
func (*Database) CreateDashboard ¶
func (*Database) DeleteComponent ¶
func (*Database) DeleteDashboard ¶
func (*Database) GetComponent ¶
func (*Database) GetConnection ¶
func (*Database) GetDashboard ¶
func (*Database) GetLatestActivity ¶
func (*Database) GetModelsSchema ¶ added in v0.3.0
GetModelsSchema retrieves the schema information of the database models. It parses the fields of predefined models (Activity, Athlete, Gear) and returns their schema details.
func (*Database) ListActivities ¶
func (*Database) ListAthletes ¶
func (*Database) ListComponents ¶
func (*Database) ListDashboards ¶
func (*Database) RunQuery ¶
RunQuery runs a SQL query after compiling it with date placeholders. It executes the query and returns the results as a slice of maps, where each map represents a row with column names as keys and column values as values. Parameters: - query: The SQL query template containing placeholders.
func (*Database) UpdateComponent ¶
func (*Database) UpdateDashboard ¶
func (*Database) UpsertActivities ¶
func (*Database) UpsertAthlete ¶
func (*Database) UpsertConfig ¶
Click to show internal directories.
Click to hide internal directories.