Documentation
¶
Index ¶
- Constants
- func InitMock(mock sqlmock.Sqlmock)
- type Airport
- type Attachment
- type ColumnsWidth
- type DBModel
- func (m *DBModel) Authenticate(login, password string) error
- func (m *DBModel) CreateDistanceCache()
- func (m *DBModel) DeleteAttachment(uuid string) error
- func (m *DBModel) DeleteAttachmentsForFlightRecord(uuid string) error
- func (m *DBModel) DeleteFlightRecord(uuid string) error
- func (m *DBModel) DeleteLicenseAttachment(uuid string) error
- func (m *DBModel) DeleteLicenseRecord(uuid string) error
- func (m *DBModel) DisableAuthorization() error
- func (m *DBModel) GetAircraftModels(condition int) ([]string, error)
- func (m *DBModel) GetAircraftRegs() ([]string, error)
- func (m *DBModel) GetAirportByID(id string) (Airport, error)
- func (m *DBModel) GetAirportCount() (int, error)
- func (m *DBModel) GetAirports() (map[string]Airport, error)
- func (m *DBModel) GetAttachmentByID(uuid string) (Attachment, error)
- func (m *DBModel) GetAttachments(recordID string) ([]Attachment, error)
- func (m *DBModel) GetFlightRecordByID(uuid string) (FlightRecord, error)
- func (m *DBModel) GetFlightRecords() ([]FlightRecord, error)
- func (m *DBModel) GetLicenseRecordByID(uuid string) (License, error)
- func (m *DBModel) GetLicenses() ([]License, error)
- func (m *DBModel) GetLicensesCategory() ([]string, error)
- func (m *DBModel) GetSettings() (Settings, error)
- func (m *DBModel) GetTotals(days int) (FlightRecord, error)
- func (m *DBModel) GetTotalsByAircraftClass() (map[string]FlightRecord, error)
- func (m *DBModel) GetTotalsByAircraftType() (map[string]FlightRecord, error)
- func (m *DBModel) GetTotalsByYear() (map[string]FlightRecord, error)
- func (m *DBModel) InsertAttachmentRecord(att Attachment) error
- func (m *DBModel) InsertFlightRecord(fr FlightRecord) error
- func (m *DBModel) InsertLicenseRecord(lic License) error
- func (m *DBModel) IsAuthEnabled() bool
- func (m *DBModel) UpdateAirportDB(airports []Airport) (int, error)
- func (m *DBModel) UpdateFlightRecord(fr FlightRecord) error
- func (m *DBModel) UpdateLicenseRecord(lic License) error
- func (m *DBModel) UpdateSettings(settings Settings) error
- type Export
- type FlightRecord
- type JSONResponse
- type License
- type Models
- type Settings
Constants ¶
const AllAircraftModels = 1
const AllTotals = 0
const JustLastModels = 2
const Last30Days = 30
const Last90Days = 90
const ThisMonth = 888
const ThisYear = 999
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Airport ¶
type Airport struct {
ICAO string `json:"icao"`
IATA string `json:"iata"`
Name string `json:"name"`
City string `json:"city"`
Country string `json:"country"`
Elevation int `json:"elevation"`
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
}
Airpot is a structure for airport record
type Attachment ¶ added in v1.4.0
type Attachment struct {
UUID string `json:"uuid"`
RecordID string `json:"record_id"`
DocumentName string `json:"document_name"`
Document []byte
}
Attachment is a type for attachments
type ColumnsWidth ¶ added in v1.11.0
type ColumnsWidth struct {
Col1 float64 `json:"col1"`
Col2 float64 `json:"col2"`
Col3 float64 `json:"col3"`
Col4 float64 `json:"col4"`
Col5 float64 `json:"col5"`
Col6 float64 `json:"col6"`
Col7 float64 `json:"col7"`
Col8 float64 `json:"col8"`
Col9 float64 `json:"col9"`
Col10 float64 `json:"col10"`
Col11 float64 `json:"col11"`
Col12 float64 `json:"col12"`
Col13 float64 `json:"col13"`
Col14 float64 `json:"col14"`
Col15 float64 `json:"col15"`
Col16 float64 `json:"col16"`
Col17 float64 `json:"col17"`
Col18 float64 `json:"col18"`
Col19 float64 `json:"col19"`
Col20 float64 `json:"col20"`
Col21 float64 `json:"col21"`
Col22 float64 `json:"col22"`
Col23 float64 `json:"col23"`
}
type DBModel ¶
DBModel is a type for database connections
func (*DBModel) Authenticate ¶ added in v1.10.0
Authenticate checks the credentials
func (*DBModel) CreateDistanceCache ¶ added in v1.3.0
func (m *DBModel) CreateDistanceCache()
CreateDistanceCache fills cache map with calculated distances
func (*DBModel) DeleteAttachment ¶ added in v1.4.0
DeleteAttachment removes attachment record
func (*DBModel) DeleteAttachmentsForFlightRecord ¶ added in v1.4.0
func (*DBModel) DeleteFlightRecord ¶
DeleteFlightRecord deletes a flight record by UUID
func (*DBModel) DeleteLicenseAttachment ¶ added in v1.6.0
DeleteLicenseAttachment drops license attachment
func (*DBModel) DeleteLicenseRecord ¶
DeleteLicenseRecord deletes a license record by UUID
func (*DBModel) DisableAuthorization ¶ added in v1.10.0
DisableAuthorization reset the auth flag in the settings
func (*DBModel) GetAircraftModels ¶
GetAircraftModels returns already recorded aircraft models
func (*DBModel) GetAircraftRegs ¶
GetAircraftRegs returns all already recorded aircraft registrations
func (*DBModel) GetAirportByID ¶
GetAirportByID return airport record by ID (ICAO or IATA)
func (*DBModel) GetAirportCount ¶
GetAirportCount returns amount of records in the airports table
func (*DBModel) GetAirports ¶
GetAirports generates Airports DB for rendering maps
func (*DBModel) GetAttachmentByID ¶ added in v1.4.0
func (m *DBModel) GetAttachmentByID(uuid string) (Attachment, error)
GetAttachmentByID returns attachment record
func (*DBModel) GetAttachments ¶ added in v1.4.0
func (m *DBModel) GetAttachments(recordID string) ([]Attachment, error)
GetAttachments returns attachments array for a specific record_id
func (*DBModel) GetFlightRecordByID ¶
func (m *DBModel) GetFlightRecordByID(uuid string) (FlightRecord, error)
GetFlightRecordByID returns flight record by UUID
func (*DBModel) GetFlightRecords ¶
func (m *DBModel) GetFlightRecords() ([]FlightRecord, error)
GetFlightRecords returns the flight records in the logbook table
func (*DBModel) GetLicenseRecordByID ¶
GetFlightRecordByID returns flight record by UUID
func (*DBModel) GetLicenses ¶
GetFlightRecords returns the flight records in the logbook table
func (*DBModel) GetLicensesCategory ¶
GetLicensesCategory returns all already recorded categories
func (*DBModel) GetSettings ¶
GetSettings returns settings parameters
func (*DBModel) GetTotals ¶
func (m *DBModel) GetTotals(days int) (FlightRecord, error)
GetTotals calculates totals
func (*DBModel) GetTotalsByAircraftClass ¶ added in v1.9.0
func (m *DBModel) GetTotalsByAircraftClass() (map[string]FlightRecord, error)
GetTotalsByAircraftClass calculates totals by aircraft class
func (*DBModel) GetTotalsByAircraftType ¶
func (m *DBModel) GetTotalsByAircraftType() (map[string]FlightRecord, error)
GetTotalsByAircraftType calculates totals by aircraft type
func (*DBModel) GetTotalsByYear ¶
func (m *DBModel) GetTotalsByYear() (map[string]FlightRecord, error)
GetTotalsByYear calculates totals by year
func (*DBModel) InsertAttachmentRecord ¶ added in v1.4.0
func (m *DBModel) InsertAttachmentRecord(att Attachment) error
InsertLicenseRecord add a new license record to the licensing table
func (*DBModel) InsertFlightRecord ¶
func (m *DBModel) InsertFlightRecord(fr FlightRecord) error
InsertFlightRecord add a new flight record to the logbook table
func (*DBModel) InsertLicenseRecord ¶
InsertLicenseRecord add a new license record to the licensing table
func (*DBModel) IsAuthEnabled ¶ added in v1.10.0
isAuthEnabled returns auth status
func (*DBModel) UpdateAirportDB ¶
UpdateAirportDB updates airports table
func (*DBModel) UpdateFlightRecord ¶
func (m *DBModel) UpdateFlightRecord(fr FlightRecord) error
UpdateFlightRecord updates the flight records in the logbook table
func (*DBModel) UpdateLicenseRecord ¶
UpdateLicenseRecord updates the license records in the licensing table
func (*DBModel) UpdateSettings ¶
UpdateSettings writes new settings values
type Export ¶ added in v1.11.0
type Export struct {
LogbookRows int `json:"logbook_rows"`
Fill int `json:"fill"`
LeftMargin float64 `json:"left_margin"`
LeftMarginA float64 `json:"left_margin_a"`
LeftMarginB float64 `json:"left_margin_b"`
TopMargin float64 `json:"top_margin"`
BodyRow float64 `json:"body_row_height"`
PageBreaks string `json:"page_breaks"`
Columns ColumnsWidth `json:"columns"`
}
type FlightRecord ¶
type FlightRecord struct {
UUID string `json:"uuid"`
Date string `json:"date"`
MDate string `json:"m_date"`
Departure struct {
Place string `json:"place"`
Time string `json:"time"`
} `json:"departure"`
Arrival struct {
Place string `json:"place"`
Time string `json:"time"`
} `json:"arrival"`
Aircraft struct {
Model string `json:"model"`
Reg string `json:"reg_name"`
} `json:"aircraft"`
Time struct {
SE string `json:"se_time"`
ME string `json:"me_time"`
MCC string `json:"mcc_time"`
Total string `json:"total_time"`
Night string `json:"night_time"`
IFR string `json:"ifr_time"`
PIC string `json:"pic_time"`
CoPilot string `json:"co_pilot_time"`
Dual string `json:"dual_time"`
Instructor string `json:"instructor_time"`
} `json:"time"`
Landings struct {
Day int `json:"day"`
Night int `json:"night"`
} `json:"landings"`
SIM struct {
Type string `json:"type"`
Time string `json:"time"`
} `json:"sim"`
PIC string `json:"pic_name"`
Remarks string `json:"remarks"`
Distance int
}
FlightRecord is a type for logbook flight records
func CalculateTotals ¶
func CalculateTotals(totals FlightRecord, record FlightRecord) FlightRecord
calculateTotals calculates totals for page footer
type JSONResponse ¶
type JSONResponse struct {
OK bool `json:"ok"`
Message string `json:"message,omitempty"`
RedirectURL string `json:"redirect_url,omitempty"`
}
jsonResponse is a type for post data handlers response
type License ¶
type License struct {
UUID string `json:"uuid"`
Category string `json:"category"`
Name string `json:"name"`
Number string `json:"number"`
Issued string `json:"issued"`
ValidFrom string `json:"valid_from"`
ValidUntil string `json:"valid_until"`
DocumentName string `json:"document_name"`
Document []byte
}
License is a type for licesing
type Settings ¶
type Settings struct {
OwnerName string `json:"owner_name"`
SignatureText string `json:"signature_text"`
AircraftClasses map[string]string `json:"aircraft_classes"`
AuthEnabled bool `json:"auth_enabled"`
Login string `json:"login"`
Password string `json:"password"`
Hash string `json:"hash"`
ExportA4 Export `json:"export_a4"`
ExportA5 Export `json:"export_a5"`
}
Settings is a type for settings