contacts

package
v0.0.0-...-22c3f85 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveContact

func SaveContact(c Contact, store firestore.Client) (e error)

SaveContact will save the contact created in the main func TODO Pull in all the junk to make this work.

Types

type Contact

type Contact struct {
	ID         string `firestore:"id"`
	LastName   string `firestore:"last_name"`
	FirstName  string `firestore:"first_name"`
	BirthYear  int    `firestore:"birth_year"`
	BirthMonth int    `firestore:"birth_month"`
	BirthDay   int    `firestore:"birth_day"`
	Email      string `firestore:"email"`
}

Contact is the base structure for Scouts, Leaders, and any other individuals referenced by this application.

func GetAllContacts

func GetAllContacts() []Contact

GetAllContacts gets all Contact entities TODO: make the return slice a slice of pointers to contacts

func (Contact) Greeter

func (c Contact) Greeter() (greeting string)

Greeter is a sample method

func (Contact) Server

func (c Contact) Server(w http.ResponseWriter, r *http.Request)

Server implements http.Handler

type Repository

type Repository interface {
	Add(Contact) error
	Read(string) (Contact, error)
}

Repository interface defines the methods that can be used on the Service

type Service

type Service interface {
	Add(Contact) error
	Read(string) (Contact, error)
}

Service returns the Client service

func NewService

func NewService() Service

NewService returns a pointer to the Contact service

type Storage

type Storage struct {
	DB  *firestore.Client
	Ctx context.Context
}

Storage holds the pointer to the Firestore client

func NewStorage

func NewStorage() (*Storage, error)

NewStorage returns the pointer to the Firstore client

func (*Storage) Add

func (s *Storage) Add(c Contact) (e error)

Create DODODO

func (*Storage) Read

func (s *Storage) Read(cid string) (c Contact, e error)

Read DODODO

Jump to

Keyboard shortcuts

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