gtbackend

package module
v0.0.0-...-ca33a47 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2018 License: GPL-3.0 Imports: 15 Imported by: 3

README

gt-backend

Master: CircleCI Develop: CircleCI Go Report Card Maintainability Test Coverage Project Status

Backend for handling uploading, storing and processing IGC files, and users in the system. REST

Cloning

Update govendor

  • govendor sync

Pre running locally (linux)

  • export PORT=xxxx

Documentation

Index

Constants

View Source
const APPLICATION = "application-log"

APPLICATION log file prefix.

View Source
const CONNECTOR = "connector-log"

CONNECTOR log file prefix.

View Source
const LOGS = "logs"

LOGS log directory name.

Variables

View Source
var LogPath string

LogPath stores log directory path.

Functions

func DebugLogErrMsg

func DebugLogErrMsg(h InternalLogHeader, err error, msg string)

DebugLogErrMsg - Logs request with both error and message

func DebugLogErrNoMsg

func DebugLogErrNoMsg(h InternalLogHeader, err error)

DebugLogErrNoMsg - Logs request without message

func DebugLogNoErrMsg

func DebugLogNoErrMsg(h InternalLogHeader, msg string)

DebugLogNoErrMsg - Logs request without error

func DeleteFileFromLocalStorage

func DeleteFileFromLocalStorage(uid string, fileName string) (err error)

DeleteFileFromLocalStorage takes a uid and a filename and deletes a File determined by the params

func FileToLines

func FileToLines(file *os.File) (lines []string, err error)

FileToLines will traverse and return an array with all file lines.

func GetBoolFromString

func GetBoolFromString(toCheck string) (b bool)

GetBoolFromString converts a string representation of bool to type bool default false

func GetLogWriter

func GetLogWriter(path string) (writer *rotatelogs.RotateLogs, err error)

GetLogWriter will return a file log writer.

func GetUnixTime

func GetUnixTime() (stamp int64)

GetUnixTime returns a unix timestamp for when the method got called

func LogFatalErrMsg

func LogFatalErrMsg(h InternalLogHeader, err error, msg string)

LogFatalErrMsg - Logs request with both error and message

func LogFatalErrNoMsg

func LogFatalErrNoMsg(h InternalLogHeader, err error)

LogFatalErrNoMsg - Logs request without message

func LogFatalNoErrMsg

func LogFatalNoErrMsg(h InternalLogHeader, msg string)

LogFatalNoErrMsg - Logs request without error

func LogIncomingRequests

func LogIncomingRequests(next http.Handler) http.Handler

LogIncomingRequests - Logs request traffic into our app.

func SaveFileToLocalStorage

func SaveFileToLocalStorage(uid string, fileNameRaw string, src multipart.File) (file *os.File, fileName string, err error)

SaveFileToLocalStorage - Save the uploaded File in the filesystem. Path: .Records/{uId}/

func SetLogConfig

func SetLogConfig(newConfig LogConfig)

SetLogConfig sets logger config.

func SetLogConfigDefault

func SetLogConfigDefault()

SetLogConfigDefault restore logger initial config.

Types

type A

type A struct {
	ManufacturerID string
	UniqueID       string
	Additional     string
}

A A record in IGC spec, always the first record in a IGC File. Contains information about FR manufacturer and ID, as well as some additional information (dunno what it is though).

type H

type H struct {
	Pilot              string
	FlightRecorderType string
	GliderType         string
	GliderID           string
	FirmwareVersion    string
	HardwareVersion    string
	Date               string
}

H record, Metadata/header information from a FR recorded flight.

type InternalLogHeader

type InternalLogHeader struct {
	Origin string
	Method string
}

InternalLogHeader internal log entry without error and message for initialization

func DebugLogPrepareHeader

func DebugLogPrepareHeader(origin string, method string) InternalLogHeader

DebugLogPrepareHeader - Returns a prepared header for logging

type LogConfig

type LogConfig struct {
	Path string
}

LogConfig enables users to dictate where log file are to be put.

func GetLogConfig

func GetLogConfig() LogConfig

GetLogConfig fetch logger config.

type LoggingMiddleware

type LoggingMiddleware func(http.Handler) http.Handler

LoggingMiddleware - capture http.Handle.

type Parser

type Parser struct {
	Parsed string
}

Parser holds a file, mostly done to keep as much as possible private, while also support testing.

func (Parser) Parse

func (parser Parser) Parse() (rec Record, err error)

Parse - main routine for parsing a IGC-track. Returns a Record.

type Record

type Record struct {
	Manufacturer A
	Header       H
}

Record is the metadata information about a IGC approved FR recorded flight. Contains information about the flight recorder itself, as well as some selected header information from the flight.

type SecurityMiddleware

type SecurityMiddleware struct {
	App *firebase.App
}

SecurityMiddleware - capture http.Handle.

func (*SecurityMiddleware) CheckIncomingRequests

func (sec *SecurityMiddleware) CheckIncomingRequests(next http.Handler) http.Handler

CheckIncomingRequests - Logs request traffic into our app.

Directories

Path Synopsis
Package constant package contains files with various constants in the application.
Package constant package contains files with various constants in the application.
Package models contains various data-structures both for internal usage and payloads in the RESTapi
Package models contains various data-structures both for internal usage and payloads in the RESTapi

Jump to

Keyboard shortcuts

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