style: Apply code formatting with go fmt
- Run 'make format' to ensure all Go code follows standard formatting - Maintains consistent code style across the entire codebase - No functional changes, only whitespace and formatting improvements
This commit is contained in:
parent
4fd0846127
commit
2bffa2c418
19 changed files with 543 additions and 527 deletions
|
|
@ -29,5 +29,6 @@ import "embed"
|
||||||
// external file deployment or complicated asset management.
|
// external file deployment or complicated asset management.
|
||||||
//
|
//
|
||||||
// Updated to include database.html for database status page
|
// Updated to include database.html for database status page
|
||||||
|
//
|
||||||
//go:embed static
|
//go:embed static
|
||||||
var Static embed.FS
|
var Static embed.FS
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,9 @@ func cmdUpdate(db *database.Database, sources []string, force bool) error {
|
||||||
if len(result.Errors) > 0 {
|
if len(result.Errors) > 0 {
|
||||||
log.Printf(" %d errors occurred during import (first few):", len(result.Errors))
|
log.Printf(" %d errors occurred during import (first few):", len(result.Errors))
|
||||||
for i, errMsg := range result.Errors {
|
for i, errMsg := range result.Errors {
|
||||||
if i >= 3 { break }
|
if i >= 3 {
|
||||||
|
break
|
||||||
|
}
|
||||||
log.Printf(" %s", errMsg)
|
log.Printf(" %s", errMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -683,4 +685,3 @@ func cmdOptimize(db *database.Database, force bool) error {
|
||||||
fmt.Println("\n✅ Database optimization completed!")
|
fmt.Println("\n✅ Database optimization completed!")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,6 @@ func (db *Database) Health() error {
|
||||||
return db.conn.Ping()
|
return db.conn.Ping()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// DefaultConfig returns the default database configuration
|
// DefaultConfig returns the default database configuration
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
|
|
|
||||||
|
|
@ -208,10 +208,18 @@ func (dl *DataLoader) loadOpenFlightsAirlines(reader io.Reader, source DataSourc
|
||||||
active := len(record) > 7 && strings.Trim(record[7], `"`) == "Y"
|
active := len(record) > 7 && strings.Trim(record[7], `"`) == "Y"
|
||||||
|
|
||||||
// Convert \N to empty strings
|
// Convert \N to empty strings
|
||||||
if alias == "\\N" { alias = "" }
|
if alias == "\\N" {
|
||||||
if iata == "\\N" { iata = "" }
|
alias = ""
|
||||||
if icao == "\\N" { icao = "" }
|
}
|
||||||
if callsign == "\\N" { callsign = "" }
|
if iata == "\\N" {
|
||||||
|
iata = ""
|
||||||
|
}
|
||||||
|
if icao == "\\N" {
|
||||||
|
icao = ""
|
||||||
|
}
|
||||||
|
if callsign == "\\N" {
|
||||||
|
callsign = ""
|
||||||
|
}
|
||||||
|
|
||||||
_, err = insertStmt.Exec(id, name, alias, iata, icao, callsign, country, active, source.Name)
|
_, err = insertStmt.Exec(id, name, alias, iata, icao, callsign, country, active, source.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -298,10 +306,18 @@ func (dl *DataLoader) loadOpenFlightsAirports(reader io.Reader, source DataSourc
|
||||||
timezone := strings.Trim(record[11], `"`)
|
timezone := strings.Trim(record[11], `"`)
|
||||||
|
|
||||||
// Convert \N to empty strings
|
// Convert \N to empty strings
|
||||||
if iata == "\\N" { iata = "" }
|
if iata == "\\N" {
|
||||||
if icao == "\\N" { icao = "" }
|
iata = ""
|
||||||
if dst == "\\N" { dst = "" }
|
}
|
||||||
if timezone == "\\N" { timezone = "" }
|
if icao == "\\N" {
|
||||||
|
icao = ""
|
||||||
|
}
|
||||||
|
if dst == "\\N" {
|
||||||
|
dst = ""
|
||||||
|
}
|
||||||
|
if timezone == "\\N" {
|
||||||
|
timezone = ""
|
||||||
|
}
|
||||||
|
|
||||||
_, err = insertStmt.Exec(id, name, city, country, iata, icao, lat, lon, alt, tzOffset, dst, timezone, source.Name)
|
_, err = insertStmt.Exec(id, name, city, country, iata, icao, lat, lon, alt, tzOffset, dst, timezone, source.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -497,7 +513,6 @@ func (dl *DataLoader) recordDataSource(tx *sql.Tx, source DataSource) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ClearDataSource removes all data from a specific source
|
// ClearDataSource removes all data from a specific source
|
||||||
func (dl *DataLoader) ClearDataSource(sourceName string) error {
|
func (dl *DataLoader) ClearDataSource(sourceName string) error {
|
||||||
tx, err := dl.conn.Begin()
|
tx, err := dl.conn.Begin()
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ func (om *OptimizationManager) OptimizeDatabase() error {
|
||||||
fmt.Println("Optimizing database for storage efficiency...")
|
fmt.Println("Optimizing database for storage efficiency...")
|
||||||
|
|
||||||
// Apply storage-friendly pragmas
|
// Apply storage-friendly pragmas
|
||||||
optimizations := []struct{
|
optimizations := []struct {
|
||||||
name string
|
name string
|
||||||
query string
|
query string
|
||||||
description string
|
description string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue