flight

package
v0.0.0-...-2a68481 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flight

type Flight struct {
	common.Timestamp
	ID     string `gorm:"primaryKey;column:id;size:64"`
	UserID string `gorm:"column:userid;size:64"`

	StartID      uint              `gorm:"column:startid"`
	LandingID    uint              `gorm:"column:landingid"`
	Start        start.Start       `gorm:"foreignkey:StartID;references:id"`
	Landing      location.Location `gorm:"foreignkey:LandingID;references:id"`
	FlyingDevice string            `gorm:"column:flyingdevice;size:64"`
	Privacy      PrivacyLevel      `gorm:"column:privacylevel"`
	Description  string            `gorm:"column:description"`
	Duration     int               `gorm:"column:duration"`
	MaxHeight    int               `gorm:"column:maxHeight"`
	MinHeight    int               `gorm:"column:minHeight"`
	Distance     int               `gorm:"column:distance"`
}

Flight describes one flight

func (Flight) TableName

func (Flight) TableName() string

TableName - defines which tablename is used in the database

type FlightService

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

FlightService defines the flightservice

func (*FlightService) Create

func (f *FlightService) Create(flight *Flight) (string, error)

func (*FlightService) FlightById

func (f *FlightService) FlightById(id string) (*Flight, error)

func (*FlightService) FlightByLocation

func (f *FlightService) FlightByLocation(id int) (*Flight, error)

func (*FlightService) Update

func (f *FlightService) Update(flight *Flight) error

type MariadbRepo

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

MariadbRepo struct holding

func NewRepository

func NewRepository(context *gorm.DB) (*MariadbRepo, error)

NewRepository creates a new repository

func (*MariadbRepo) Create

func (m *MariadbRepo) Create(flight *Flight) (string, error)

func (*MariadbRepo) FlightById

func (m *MariadbRepo) FlightById(id string) (*Flight, error)

func (*MariadbRepo) FlightByLocation

func (m *MariadbRepo) FlightByLocation(id int) (*Flight, error)

func (*MariadbRepo) Update

func (m *MariadbRepo) Update(flight *Flight) error

type PrivacyLevel

type PrivacyLevel int

PrivacyLevel describes the shared status of an entity

const (
	// ProtectedLevel describes a level where a user can be seen by anyone who has a flightlog login
	ProtectedLevel PrivacyLevel = 1
	// PrivateLevel describes a level where a user needs to grant access to those who wants access
	PrivateLevel PrivacyLevel = 2
	// PublicLevel describes a user that anyone can watch with or without login
	PublicLevel PrivacyLevel = 0
)

type Reader

type Reader interface {
	FlightById(id string) (*Flight, error)
	FlightByLocation(id int) (*Flight, error)
}

type Repository

type Repository interface {
	Reader
	Writer
}

Repository describes the repository interface

type Service

type Service interface {
	Reader
	Writer
}

Service describes the service interface

func NewService

func NewService(serviceUrl string, servicePort string, repository Repository, config common.ServiceConfig, locationService location.Service) (Service, error)

NewService - creates a new service

type Writer

type Writer interface {
	Create(flight *Flight) (string, error)
	Update(flight *Flight) error
}

Writer describes actions related to writing flights

Jump to

Keyboard shortcuts

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