Documentation ¶
Index ¶
- func GetMongoInstance() (*mongo.Client, context.Context, context.CancelFunc)
- func RedisExists(key string) (bool, error)
- func RedisGet(key string) ([]byte, error)
- func RedisGetSlice(key string) ([][]byte, error)
- func RedisSet(key string, value interface{}) error
- func RedisTTL(key string, ttl int) error
- func Setup()
- func SetupCache()
- type Box
- type City
- type Constituency
- type District
- type IndividualInBox
- type PartyInBox
- type Quarter
- type RedisConnectionOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMongoInstance ¶
Get a Mongo instance (Client, Context, Cancel)
func RedisGetSlice ¶
Get a slice of values from redis
Types ¶
type Box ¶
type Box struct { Id primitive.ObjectID `json:"_id" bson:"_id"` Number int64 `json:"number" bson:"number"` // 1001 City string `json:"city" bson:"city"` // Ankara CityNumber int64 `json:"citynumber" bson:"citynumber"` // 6 Constituency string `json:"constituency" bson:"constituency"` // Ankara-1 District string `json:"district" bson:"district"` // Çankaya Quarter string `json:"quarter" bson:"quarter"` // Çukurambar Parties []PartyInBox `json:"parties" bson:"parties"` Individuals []IndividualInBox `json:"individuals" bson:"individuals"` EligibleVoters int64 `json:"eligiblevoters" bson:"eligiblevoters"` // 12621 ActualVoters int64 `json:"actualvoters" bson:"actualvoters"` // 10262 ValidVotes int64 `json:"validvotes" bson:"validvotes"` // 10101 InvalidVotes int64 `json:"invalidvotes" bson:"invalidvotes"` // 161 SST string `json:"sst" bson:"sst"` // 24923948264 (Static File Storage Microservice) SDC string `json:"sdc" bson:"sdc"` // 42424234242 (Static File Storage Microservice) }
Model for the ballot box object
type City ¶
type City struct { Id primitive.ObjectID `json:"_id" bson:"_id"` Name string `json:"name" bson:"name" validate:"required"` // Ankara Number int64 `json:"number" bson:"number" validate:"required,numeric"` // 6 Parties []PartyInBox `json:"parties" bson:"parties"` Individuals []IndividualInBox `json:"individuals" bson:"individuals"` EligibleVoters int64 `json:"eligiblevoters" bson:"eligiblevoters" validate:"numeric"` // 12621 ActualVoters int64 `json:"actualvoters" bson:"actualvoters" validate:"numeric"` // 10262 ValidVotes int64 `json:"validvotes" bson:"validvotes" validate:"numeric"` // 10101 InvalidVotes int64 `json:"invalidvotes" bson:"invalidvotes" validate:"numeric"` // 161 }
Model for the city
type Constituency ¶
type Constituency struct { Id primitive.ObjectID `json:"_id" bson:"_id"` Name string `json:"name" bson:"name" validate:"required"` City string `json:"city" bson:"city" validate:"required"` // Ankara CityNumber int64 `json:"citynumber" bson:"citynumber" validate:"required,numeric"` // 6 Parties []PartyInBox `json:"parties" bson:"parties"` Individuals []IndividualInBox `json:"individuals" bson:"individuals"` EligibleVoters int64 `json:"eligiblevoters" bson:"eligiblevoters"` // 12621 ActualVoters int64 `json:"actualvoters" bson:"actualvoters"` // 10262 ValidVotes int64 `json:"validvotes" bson:"validvotes"` // 10101 InvalidVotes int64 `json:"invalidvotes" bson:"invalidvotes"` // 161 }
Model for the constituency
type District ¶
type District struct { Id primitive.ObjectID `json:"_id" bson:"_id"` Name string `json:"name" bson:"name"` // Cankaya City string `json:"city" bson:"city"` // Ankara CityNumber int64 `json:"citynumber" bson:"citynumber"` // 6 Constituency string `json:"constituency" bson:"constituency"` // ankara-1 Parties []PartyInBox `json:"parties" bson:"parties"` Individuals []IndividualInBox `json:"individuals" bson:"individuals"` EligibleVoters int64 `json:"eligiblevoters" bson:"eligiblevoters"` // 12621 ActualVoters int64 `json:"actualvoters" bson:"actualvoters"` // 10262 ValidVotes int64 `json:"validvotes" bson:"validvotes"` // 10101 InvalidVotes int64 `json:"invalidvotes" bson:"invalidvotes"` // 161 }
Model for the district
type IndividualInBox ¶
type IndividualInBox struct { FirstName string `json:"firstname" bson:"firstname"` // Max LastName string `json:"lastname" bson:"lastname"` // Mustermann Votes int64 `json:"votes" bson:"votes"` // 121 }
Model for a Individual in a Box
type PartyInBox ¶
type PartyInBox struct { Name string `json:"name" bson:"name"` // CHP Votes int64 `json:"votes" bson:"votes"` // 121 }
Model for a Party in a Box
type Quarter ¶
type Quarter struct { Id primitive.ObjectID `json:"_id" bson:"_id"` Name string `json:"name" bson:"name"` // Cevizlidere City string `json:"city" bson:"city"` // Ankara CityNumber int64 `json:"citynumber" bson:"citynumber"` // 6 Constituency string `json:"constituency" bson:"constituency"` // Ankara-1 District string `json:"district" bson:"district"` // Cankaya Parties []PartyInBox `json:"parties" bson:"parties"` Individuals []IndividualInBox `json:"individuals" bson:"individuals"` EligibleVoters int64 `json:"eligiblevoters" bson:"eligiblevoters"` // 12621 ActualVoters int64 `json:"actualvoters" bson:"actualvoters"` // 10262 ValidVotes int64 `json:"validvotes" bson:"validvotes"` // 10101 InvalidVotes int64 `json:"invalidvotes" bson:"invalidvotes"` // 161 }
Model for the quarter
Click to show internal directories.
Click to hide internal directories.