petfind

package
v0.0.0-...-42776a7 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("item not found")

ErrNotFound is returned whenever an item does not exist in the Store.

View Source
var PlaceGroups = []PlaceGroup{
	{
		Name: "Αττική",
		Places: []Place{
			{Key: "1", Name: "Αγία Βαρβάρα"},
			{Key: "2", Name: "Αγία Παρασκευή"},
			{Key: "3", Name: "Άγιοι Ανάργυροι"},
			{Key: "4", Name: "Άγιος Δημήτριος"},
			{Key: "5", Name: "Άγιος Ιωάννης Ρέντη"},
			{Key: "6", Name: "Άγιος Στέφανος"},
			{Key: "7", Name: "Αθήνα Κέντρο"},
			{Key: "8", Name: "Αιγάλεω"},
			{Key: "9", Name: "Αίγινα"},
			{Key: "10", Name: "Άλιμος"},
			{Key: "11", Name: "Αλσούπολη"},
			{Key: "12", Name: "Αμπελόκηποι"},
			{Key: "13", Name: "Ανάβυσσος"},
			{Key: "14", Name: "Ανθούσα"},
			{Key: "15", Name: "Άνοιξη"},
			{Key: "16", Name: "Άνω Λιόσια"},
			{Key: "17", Name: "Άνω Πατήσια"},
			{Key: "18", Name: "Αργυρούπολη"},
			{Key: "19", Name: "Αρτέμιδα"},
			{Key: "20", Name: "Ασπρόπυργος"},
			{Key: "21", Name: "Αχαρνές"},
			{Key: "22", Name: "Βάρη"},
			{Key: "23", Name: "Βάρκιζα"},
			{Key: "24", Name: "Βοτανικός"},
			{Key: "25", Name: "Βούλα"},
			{Key: "26", Name: "Βουλιαγμένη"},
			{Key: "27", Name: "Βριλήσσια"},
			{Key: "28", Name: "Βύρωνας"},
			{Key: "29", Name: "Γαλάτσι"},
			{Key: "30", Name: "Γέρακας"},
			{Key: "31", Name: "Γκάζι"},
			{Key: "32", Name: "Γκύζη"},
			{Key: "33", Name: "Γλυκά Νερά"},
			{Key: "34", Name: "Γλυφάδα"},
			{Key: "35", Name: "Γουδί"},
			{Key: "36", Name: "Δάφνη"},
			{Key: "37", Name: "Διόνυσος"},
			{Key: "38", Name: "Δραπετσώνα"},
			{Key: "39", Name: "Δροσιά"},
			{Key: "40", Name: "Εκάλη"},
			{Key: "41", Name: "Ελευσίνα"},
			{Key: "42", Name: "Ελληνικό"},
			{Key: "43", Name: "Εξάρχεια"},
			{Key: "44", Name: "Ζεφύρι"},
			{Key: "45", Name: "Ζωγράφου"},
			{Key: "46", Name: "Ηλιούπολη"},
			{Key: "47", Name: "Ηράκλειο"},
			{Key: "48", Name: "Θησείο"},
			{Key: "49", Name: "Θρακομακεδόνες"},
			{Key: "50", Name: "Ίλιον"},
			{Key: "51", Name: "Ιλίσια"},
			{Key: "52", Name: "Καισαριανή"},
			{Key: "53", Name: "Καλαμάκι"},
			{Key: "54", Name: "Καλλιθέα"},
			{Key: "55", Name: "Καλλίπολη"},
			{Key: "56", Name: "Καλύβια"},
			{Key: "57", Name: "Καματερό"},
			{Key: "58", Name: "Καμίνια"},
			{Key: "59", Name: "Κάντζα"},
			{Key: "60", Name: "Καπανδρίτι"},
			{Key: "61", Name: "Καρέας"},
			{Key: "62", Name: "Κάτω Πατήσια"},
			{Key: "63", Name: "Κεραμεικός"},
			{Key: "64", Name: "Κερατσίνι"},
			{Key: "65", Name: "Κηφισιά"},
			{Key: "66", Name: "Κοκκινιά"},
			{Key: "67", Name: "Κολωνάκι"},
			{Key: "68", Name: "Κολωνός"},
			{Key: "69", Name: "Κορυδαλλός"},
			{Key: "70", Name: "Κορωπί"},
			{Key: "71", Name: "Κουκάκι"},
			{Key: "72", Name: "Κρυονέρι"},
			{Key: "73", Name: "Κυψέλη"},
			{Key: "74", Name: "Λαγονήσι"},
			{Key: "75", Name: "Λαμπρινή"},
			{Key: "76", Name: "Λαύριο"},
			{Key: "77", Name: "Λυκαβηττός"},
			{Key: "78", Name: "Λυκόβρυση"},
			{Key: "79", Name: "Μακρυγιάννη"},
			{Key: "80", Name: "Μανιάτικα"},
			{Key: "81", Name: "Μαρκόπουλο"},
			{Key: "82", Name: "Μαρούσι"},
			{Key: "83", Name: "Μέγαρα"},
			{Key: "84", Name: "Μελίσσια"},
			{Key: "85", Name: "Μεταμόρφωση"},
			{Key: "86", Name: "Μεταξουργείο"},
			{Key: "87", Name: "Μοναστηράκι"},
			{Key: "88", Name: "Μοσχάτο"},
			{Key: "89", Name: "Μουσείο"},
			{Key: "90", Name: "Νέα Ερυθραία"},
			{Key: "91", Name: "Νέα Ιωνία"},
			{Key: "92", Name: "Νέα Μάκρη"},
			{Key: "93", Name: "Νέα Πεντέλη"},
			{Key: "94", Name: "Νέα Πέραμος"},
			{Key: "95", Name: "Νεάπολη"},
			{Key: "96", Name: "Νέα Σμύρνη"},
			{Key: "97", Name: "Νέα Φιλαδέλφεια"},
			{Key: "98", Name: "Νέα Φιλοθέη"},
			{Key: "99", Name: "Νέα Χαλκηδόνα"},
			{Key: "100", Name: "Νέος Βουτσάς"},
			{Key: "101", Name: "Νέος Κόσμος"},
			{Key: "102", Name: "Νέο Φάληρο"},
			{Key: "103", Name: "Νέο Ψυχικό"},
			{Key: "104", Name: "Νίκαια"},
			{Key: "105", Name: "Οινόη"},
			{Key: "106", Name: "Παγκράτι"},
			{Key: "107", Name: "Παιανία"},
			{Key: "108", Name: "Παλαιό Φάληρο"},
			{Key: "109", Name: "Παλαιό Ψυχικό"},
			{Key: "110", Name: "Παλλήνη"},
			{Key: "111", Name: "Παπάγου"},
			{Key: "112", Name: "Πατήσια"},
			{Key: "113", Name: "Πεδίον Άρεως"},
			{Key: "114", Name: "Πειραιάς"},
			{Key: "115", Name: "Πεντέλη"},
			{Key: "116", Name: "Πέραμα"},
			{Key: "117", Name: "Περιστέρι"},
			{Key: "118", Name: "Πετράλωνα"},
			{Key: "119", Name: "Πετρούπολη"},
			{Key: "120", Name: "Πεύκη"},
			{Key: "121", Name: "Πικέρμι"},
			{Key: "122", Name: "Πλάκα"},
			{Key: "123", Name: "Πολύγωνο"},
			{Key: "124", Name: "Πόρτο Ράφτη"},
			{Key: "125", Name: "Ραφήνα"},
			{Key: "126", Name: "Ριζούπολη"},
			{Key: "127", Name: "Ροδόπολη"},
			{Key: "128", Name: "Ρουφ"},
			{Key: "129", Name: "Σαλαμίνα"},
			{Key: "130", Name: "Σαρωνίδα"},
			{Key: "131", Name: "Σεπόλια"},
			{Key: "132", Name: "Σκαραμαγκάς"},
			{Key: "133", Name: "Σούνιο"},
			{Key: "134", Name: "Σπάτα"},
			{Key: "135", Name: "Σταμάτα"},
			{Key: "136", Name: "Ταμπούρια"},
			{Key: "137", Name: "Ταύρος"},
			{Key: "138", Name: "Υμηττός"},
			{Key: "139", Name: "Φιλοθέη"},
			{Key: "140", Name: "Φίξ"},
			{Key: "141", Name: "Χαϊδάρι"},
			{Key: "142", Name: "Χαλάνδρι"},
			{Key: "143", Name: "Χολαργός"},
			{Key: "144", Name: "Ψυρρή"},
			{Key: "145", Name: "Ψυχικό"},
		},
	},
	{
		Name: "Θεσσαλονίκη",
		Places: []Place{
			{Key: "146", Name: "40 Εκκλησιές"},
			{Key: "147", Name: "Άγιος Παύλος"},
			{Key: "148", Name: "Άγιος Φανούριος"},
			{Key: "149", Name: "Άνω Πόλη"},
			{Key: "150", Name: "Άνω Τούμπα"},
			{Key: "151", Name: "Αγία Τριάδα"},
			{Key: "152", Name: "Αμπελόκηποι"},
			{Key: "153", Name: "Ανάληψη"},
			{Key: "154", Name: "Αριστοτέλους"},
			{Key: "155", Name: "Ασβεστοχώρι"},
			{Key: "156", Name: "Βαρδάρης"},
			{Key: "157", Name: "Διαβατά"},
			{Key: "158", Name: "Ελευθέριο Κορδελιό"},
			{Key: "159", Name: "Εξοχή"},
			{Key: "160", Name: "Επανομή"},
			{Key: "161", Name: "Ευκαρπία"},
			{Key: "162", Name: "Εύοσμος"},
			{Key: "163", Name: "Θέρμη"},
			{Key: "164", Name: "Θεσσαλονίκη"},
			{Key: "165", Name: "Κάτω Τούμπα"},
			{Key: "166", Name: "Καλαμαριά"},
			{Key: "167", Name: "Καλοχώρι"},
			{Key: "168", Name: "Καρδία"},
			{Key: "169", Name: "Λαδάδικα"},
			{Key: "170", Name: "Λαχανόκηποι"},
			{Key: "171", Name: "Λιμάνι"},
			{Key: "172", Name: "Μενεμένη"},
			{Key: "173", Name: "Μηχανιώνα"},
			{Key: "174", Name: "Νέα Ελβετία"},
			{Key: "175", Name: "Νέα Μαγνησία"},
			{Key: "176", Name: "Νέο Ρύσιο"},
			{Key: "177", Name: "Νέοι Επιβάτες"},
			{Key: "178", Name: "Νεάπολη"},
			{Key: "179", Name: "Ντεπώ"},
			{Key: "180", Name: "Ξηροκρήνη"},
			{Key: "181", Name: "Παλαιά Παραλία"},
			{Key: "182", Name: "Παλαιός Σταθμός"},
			{Key: "183", Name: "Πανόραμα"},
			{Key: "184", Name: "Περαία"},
			{Key: "185", Name: "Πλαγιάρι"},
			{Key: "186", Name: "Πολίχνη"},
			{Key: "187", Name: "Πυλαία"},
			{Key: "188", Name: "Ρετζίκι"},
			{Key: "189", Name: "Ροτόντα"},
			{Key: "190", Name: "Σίνδος"},
			{Key: "191", Name: "Σταυρούπολη"},
			{Key: "192", Name: "Συκιές"},
			{Key: "193", Name: "Σφαγεία"},
			{Key: "194", Name: "Ταγαράδες"},
			{Key: "195", Name: "Τούμπα"},
			{Key: "196", Name: "Τρίλοφος"},
			{Key: "197", Name: "Τριανδρία"},
			{Key: "198", Name: "Τσαλδάρη"},
			{Key: "199", Name: "Φάληρο"},
			{Key: "200", Name: "Φίλυρο"},
			{Key: "201", Name: "Χαριλάου"},
			{Key: "202", Name: "Χορτιάτης"},
			{Key: "203", Name: "Ωραιόκαστρο"},
		},
	},
	{
		Name: "Υπόλοιπη Ελλάδα",
		Places: []Place{
			{Key: "204", Name: "Άγ. Νικόλαος Κρήτης"},
			{Key: "205", Name: "Αγρίνιο"},
			{Key: "206", Name: "Αλεξανδρούπολη"},
			{Key: "207", Name: "Αμαλιάδα"},
			{Key: "208", Name: "Άργος"},
			{Key: "209", Name: "Άρτα"},
			{Key: "210", Name: "Βέροια"},
			{Key: "211", Name: "Βόλος"},
			{Key: "212", Name: "Γιαννιτσά"},
			{Key: "213", Name: "Γρεβενά"},
			{Key: "214", Name: "Δράμα"},
			{Key: "215", Name: "Έδεσσα"},
			{Key: "216", Name: "Ηράκλειο Κρήτης"},
			{Key: "217", Name: "Ιεράπετρα Κρήτης"},
			{Key: "218", Name: "Ιωάννινα"},
			{Key: "219", Name: "Καβάλα"},
			{Key: "220", Name: "Καλαμάτα"},
			{Key: "221", Name: "Καρδίτσα"},
			{Key: "222", Name: "Καστοριά"},
			{Key: "223", Name: "Κατερίνη"},
			{Key: "224", Name: "Κέρκυρα"},
			{Key: "225", Name: "Κιλκίς"},
			{Key: "226", Name: "Κοζάνη"},
			{Key: "227", Name: "Κομοτηνή"},
			{Key: "228", Name: "Κόρινθος"},
			{Key: "229", Name: "Κως"},
			{Key: "230", Name: "Λαμία"},
			{Key: "231", Name: "Λάρισα"},
			{Key: "232", Name: "Λιβαδειά"},
			{Key: "233", Name: "Μεσολόγγι"},
			{Key: "234", Name: "Μύκονος"},
			{Key: "235", Name: "Ναύπακτος"},
			{Key: "236", Name: "Ναύπλιο"},
			{Key: "237", Name: "Ξάνθη"},
			{Key: "238", Name: "Ορεστιάδα"},
			{Key: "239", Name: "Πάτρα"},
			{Key: "240", Name: "Πτολεμαΐδα"},
			{Key: "241", Name: "Πύργος"},
			{Key: "242", Name: "Ρέθυμνο"},
			{Key: "243", Name: "Ρόδος"},
			{Key: "244", Name: "Σέρρες"},
			{Key: "245", Name: "Σητεία"},
			{Key: "246", Name: "Κρήτης"},
			{Key: "247", Name: "Σπάρτη"},
			{Key: "248", Name: "Σύρος"},
			{Key: "249", Name: "Τρίκαλα"},
			{Key: "250", Name: "Τρίπολη"},
			{Key: "251", Name: "Φλώρινα"},
			{Key: "252", Name: "Χαλκίδα"},
			{Key: "253", Name: "Χαλκιδική"},
			{Key: "254", Name: "Χανιά"},
			{Key: "255", Name: "Κρήτης"},
			{Key: "256", Name: "Χίος"},
		},
	},
}

Functions

This section is empty.

Types

type GithubUser

type GithubUser struct {
	ID    int64  `json:"id"`
	Login string `json:"login"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

GithubUser holds the data that we need to retrieve from a user's GitHub account with their permission.

type LinkedinUser

type LinkedinUser struct {
	ID        string `json:"id"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
}

LinkedinUser holds the data that we need to retrieve from a user's LinkedIn account with their permission.

type LocalPhotoStore

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

func NewPhotoStore

func NewPhotoStore(uploadPath string) *LocalPhotoStore

func (*LocalPhotoStore) ServePhoto

func (s *LocalPhotoStore) ServePhoto(w io.Writer, photo *Photo) error

func (*LocalPhotoStore) Upload

func (s *LocalPhotoStore) Upload(r io.Reader, contentType string) (*Photo, error)

type Pet

type Pet struct {
	ID      int64
	Name    string
	Age     PetAge
	Type    PetType
	Size    PetSize
	Gender  PetGender
	Created time.Time
	Updated time.Time
	Contact string
	Notes   string
	PhotoID int64
	OwnerID int64
	PlaceID int64
	Owner   *User
	Place   *Place
}

Pet holds information about each pet of the application.

type PetAge

type PetAge int64
const (
	UnknownAge PetAge = iota
	Baby
	Young
	Adult
	Senior
)

func (*PetAge) Scan

func (p *PetAge) Scan(value interface{}) error

func (PetAge) String

func (p PetAge) String() string

String returns the English name of the pet's age ("Baby", "Young", ...).

func (PetAge) Value

func (p PetAge) Value() (driver.Value, error)

type PetGender

type PetGender int64
const (
	UnknownGender PetGender = iota
	Male
	Female
)

func (*PetGender) Scan

func (p *PetGender) Scan(value interface{}) error

func (PetGender) String

func (p PetGender) String() string

func (PetGender) Value

func (p PetGender) Value() (driver.Value, error)

type PetSize

type PetSize int64
const (
	UnknownSize PetSize = iota
	Small
	Medium
	Large
	Huge
)

func (*PetSize) Scan

func (p *PetSize) Scan(value interface{}) error

func (PetSize) String

func (p PetSize) String() string

String returns the English name of the pet's size ("Small", "Medium", ...).

func (PetSize) Value

func (p PetSize) Value() (driver.Value, error)

type PetType

type PetType int64
const (
	UnknownType PetType = iota
	Cat
	Dog
)

func (*PetType) Scan

func (p *PetType) Scan(value interface{}) error

func (PetType) String

func (p PetType) String() string

String returns the English name of the pet's type ("Cat", "Dog", ...).

func (PetType) Value

func (p PetType) Value() (driver.Value, error)

type Photo

type Photo struct {
	ID               int64
	Key              string
	OriginalFilename string
	ContentType      string
	URL              string
	Created          time.Time
}

type PhotoStore

type PhotoStore interface {
	Upload(r io.Reader, contentType string) (*Photo, error)
	ServePhoto(w io.Writer, photo *Photo) error
}

type Place

type Place struct {
	ID      int64
	GroupID int64
	Key     string
	Name    string
}

type PlaceGroup

type PlaceGroup struct {
	ID     int64
	Name   string
	Places []Place
}
type Search struct {
	PlaceKey  string
	Age       PetAge
	Gender    PetGender
	Size      PetSize
	Type      PetType
	UseAge    bool
	UseGender bool
	UseSize   bool
	UseType   bool
}

type Store

type Store interface {
	AddPet(*Pet) error
	GetPet(petID int64) (*Pet, error)
	GetAllPets() ([]Pet, error)
	SearchPets(Search) ([]*Pet, error)
	CountPets() (int64, error)
	GetFeaturedPets() ([]*Pet, error)

	CreateUser(*User) error
	GetUser(userID int64) (*User, error)
	PutGithubUser(*GithubUser) (*User, error)
	GetUserByGithubID(githubID int64) (*User, error)
	PutLinkedinUser(*LinkedinUser) (*User, error)
	GetUserByLinkedinID(linkedinID string) (*User, error)

	AddPhoto(*Photo) error
	GetPhoto(photoID int64) (*Photo, error)

	AddPlaceGroups([]PlaceGroup) error
	GetPlaceGroups() ([]PlaceGroup, error)
	AddPlaceGroup(*PlaceGroup) error
	AddPlace(*Place) error
	GetPlace(int64) (*Place, error)
	GetPlaceByKey(string) (*Place, error)
	CountPlaces() (int64, error)

	MakeSchema() error
	DropSchema() error
}

Store describes the operations the application needs for persisting and retrieving data.

type User

type User struct {
	ID         int64
	GithubID   int64
	LinkedinID string
	Login      string
	Name       string
	Email      string
	Created    time.Time
	Updated    time.Time
}

User holds information about a user that is signed in the application.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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