Documentation ¶
Overview ¶
Package gspread is a local package and implements functions to access recipients and credentials data from the Google account with the Google Sheets API.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSpreadData ¶
func GetSpreadData() (spreadsheet.Spreadsheet, error)
GetSpreadData fetch the data stored in the Google SpreadSheet account and return the specififc spreadsheet to this project.
func StripIfNecessary ¶
func StripIfNecessary(s *string)
StripIfNecessary delete all spaces in the prefix and suffix string, given it pointer.
Example ¶
fooString := "Foo" StripIfNecessary(&fooString) fmt.Println(fooString) fooString = " Foo " StripIfNecessary(&fooString) fmt.Println(fooString)
Output: Foo Foo
Types ¶
type CredentialStruct ¶
CredentialStruct is the struct based in the Sheet rows format.
func GetCredentialsData ¶
func GetCredentialsData(spreadData spreadsheet.Spreadsheet) (CredentialStruct, error)
GetCredentialsData fetch the data stored in the spreadsheet and transform it in a `CredentialStruct` as described above.
type RecipientStruct ¶
type RecipientStruct struct { // Basic data, for send emails and do the verifications. Name spreadsheet.Cell Email spreadsheet.Cell City spreadsheet.Cell // Language, for emails be responsive to it. Language spreadsheet.Cell // The upcoming competitions number in the last verification. UpcomingCompetitions spreadsheet.Cell // The date/time information in string of the last verification. LastVerification spreadsheet.Cell // The pointer to spreadsheet object itself, it helps // to synchronize changes using just the `RecipientStruct`, // by example. Sheet *spreadsheet.Sheet // The upcoming competitions number that was/will be // checked in this exactly runtime. Can be a zero value // if it was not checked yet. CurrentUpcomingCompetitions int // The epoch timestamp information of the // verification in this exactly runtime. Can be // a zero value if it was not checked yet. CurrentVerificationDate int64 }
RecipientStruct is the struct based in the Sheet rows format. Every recipient has a name, email, city, upcoming competitions number and when was the last time that this number was checked. All this properties are not literal values, are `spreadsheet.Cell` objects witch contains useful information about the cell where the value is stored in addition to the value itself.
func GetRecipientsData ¶
func GetRecipientsData(spreadData spreadsheet.Spreadsheet) ([]RecipientStruct, error)
GetRecipientsData fetch the data stored in the spreadsheet, transform it in a slice of `RecipientStruct` as described above.
func (RecipientStruct) UpdateUpcomingCompetitions ¶
func (recipient RecipientStruct) UpdateUpcomingCompetitions() error
UpdateUpcomingCompetitions update the recipient date in the spreadsheet with the new upcoming competitions number and last verifications date.