models

package
v0.0.0-...-1f94a6f Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GQLCallSign = graphql.NewObject(graphql.ObjectConfig{
	Name: "Callsign",
	Fields: graphql.Fields{
		"Callsign": &graphql.Field{Type: graphql.String},
		"FirstSaw": &graphql.Field{
			Type: graphql.String,
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				return p.Source.(CallSign).FirstSaw.String(), nil
			},
		},
		"LastUpdated": &graphql.Field{
			Type: graphql.String,
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				return p.Source.(CallSign).LastUpdated.String(), nil
			},
		},
		"Class":     &graphql.Field{Type: graphql.String},
		"Region":    &graphql.Field{Type: graphql.String},
		"Stations":  &graphql.Field{Type: graphql.NewList(GQLStation)},
		"Repeaters": &graphql.Field{Type: graphql.NewList(GQLRepeaterStation)},
	},
})
View Source
var GQLRepeaterStation = graphql.NewObject(graphql.ObjectConfig{
	Name: "RepeaterStationData",
	Fields: graphql.Fields{
		"UID":           &graphql.Field{Type: graphql.String},
		"RXFrequency":   &graphql.Field{Type: graphql.Float},
		"TXFrequency":   &graphql.Field{Type: graphql.Float},
		"Callsign":      &graphql.Field{Type: graphql.String},
		"StationNumber": &graphql.Field{Type: graphql.String},
		"Region":        &graphql.Field{Type: graphql.String},
		"City":          &graphql.Field{Type: graphql.String},
		"StationType":   &graphql.Field{Type: graphql.String},
		"FirstSaw": &graphql.Field{
			Type: graphql.String,
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				return p.Source.(RepeaterStationData).FirstSaw.String(), nil
			},
		},
	},
})
View Source
var GQLStation = graphql.NewObject(graphql.ObjectConfig{
	Name: "StationData",
	Fields: graphql.Fields{
		"UID":   &graphql.Field{Type: graphql.String},
		"Owner": &graphql.Field{Type: graphql.String},
		"InclusionDate": &graphql.Field{
			Type: graphql.String,
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				return p.Source.(StationData).InclusionDate.String(), nil
			},
		},
		"Certificate": &graphql.Field{Type: graphql.String},
		"ExpirationDate": &graphql.Field{
			Type: graphql.String,
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				return p.Source.(StationData).ExpirationDate.String(), nil
			},
		},
		"Callsign":    &graphql.Field{Type: graphql.String},
		"Service":     &graphql.Field{Type: graphql.String},
		"City":        &graphql.Field{Type: graphql.String},
		"StationType": &graphql.Field{Type: graphql.String},
		"Region":      &graphql.Field{Type: graphql.String},
		"FirstSaw": &graphql.Field{
			Type: graphql.String,
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
				return p.Source.(StationData).FirstSaw.String(), nil
			},
		},
	},
})

Functions

func CallSignArrayToString

func CallSignArrayToString(data []CallSign) []string

func IndexOfString

func IndexOfString(item string, arr []string) int

Types

type CallSign

type CallSign struct {
	gorm.Model
	Callsign    string `gorm:"primary_key"`
	FirstSaw    time.Time
	LastUpdated time.Time
	Class       string
	Region      string
	Stations    []StationData         `gorm:"foreignkey:Callsign;association_foreignkey:Callsign"`
	Repeaters   []RepeaterStationData `gorm:"foreignkey:Callsign;association_foreignkey:Callsign"`
}

func MapCallsignRawData

func MapCallsignRawData(raw []map[string]string) []CallSign

func Raw2CallsignData

func Raw2CallsignData(raw map[string]string) CallSign

type CertificateData

type CertificateData struct {
	gorm.Model
	TaxId          string
	Class          string
	Certificate    string
	InclusionDate  time.Time
	ExpirationDate time.Time
	Name           string
	Status         string
}

func Raw2CertificateData

func Raw2CertificateData(raw map[string]string) CertificateData

type RepeaterStationData

type RepeaterStationData struct {
	gorm.Model
	UID           string
	RXFrequency   uint64
	TXFrequency   uint64
	Callsign      string
	StationNumber string
	City          string
	Region        string
	StationType   string
	FirstSaw      time.Time
}

func MapRepeaterStationRawData

func MapRepeaterStationRawData(raw []map[string]string) []RepeaterStationData

func Raw2RepeaterStationData

func Raw2RepeaterStationData(raw map[string]string) RepeaterStationData

func (*RepeaterStationData) GenerateUID

func (cs *RepeaterStationData) GenerateUID()

type StationData

type StationData struct {
	gorm.Model
	UID            string
	Owner          string
	Certificate    string
	InclusionDate  time.Time
	ExpirationDate time.Time
	Callsign       string
	City           string
	Service        string
	StationType    string
	Region         string
	FirstSaw       time.Time
}

func MapStationRawData

func MapStationRawData(raw []map[string]string) []StationData

func Raw2StationData

func Raw2StationData(raw map[string]string) StationData

func (*StationData) GenerateUID

func (cs *StationData) GenerateUID()

type TestData

type TestData struct {
	gorm.Model
	UID                  string
	Hash                 string
	Certificates         string
	TestDate             time.Time
	InscriptionEndDate   time.Time
	ActiveInscriptions   string
	CanceledInscriptions string
	StartTime            string
	Address              string
	MorseTest            bool
	ComputerTest         bool
	Accountable          string
	Status               string
	ContactPhone         string
	MaxVacancies         string
	AvailableVacancies   string
	Region               string
}

func MapTestDataRawData

func MapTestDataRawData(raw []map[string]string) []TestData

func Raw2TestData

func Raw2TestData(raw map[string]string) TestData

func RemoveDuplicateTestData

func RemoveDuplicateTestData(data []TestData) []TestData

func (*TestData) GenerateHash

func (td *TestData) GenerateHash()

func (*TestData) GenerateUID

func (td *TestData) GenerateUID()

Jump to

Keyboard shortcuts

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