modulepackage
0.0.0-20210311143557-2ca6c93433ff
Repository: https://github.com/joncrlsn/go-examples.git
Documentation: pkg.go.dev
# README
go-examples
Examples of GoLang code that I will use and return to over time.
To run one: go run <filename>.go
There is also a secure web example I'm working on in the web sub-package
# Packages
Sets up the database connection and ensure the schema is migrated.
No description provided by the author
Copyright (c) 2015 Jon Carlson.
Thank you to William Kennedy who shared his code here: http://www.goinggo.net/2013/06/send-email-in-go-with-smtpsendmail.html
Example call: SendEmail( "smtp.gmail.com", 587, "[email protected]", "password", []string{"[email protected]"}, "testing subject", "<html><body>Exception 1</body></html>Exception 1") }
.
# Functions
ChooseOne prompts the user to enter one of n values Example: answer := misc.PromptOne("Continue, Quit, or Redo? [cqr]: ", ["c", "q", "r"]).
ComparePassword hashes the test password and then compares the two hashes.
ComparePassword hashes the test password with the same salt used for the real password and then compares the two hashes.
No description provided by the author
DownloadFile will download a url to a local file.
DownloadFile will download a url to a local file.
No description provided by the author
Guid returns an pseudo globally unique identifier as an int64 The first 5 bytes are the time portion (100ths of a second since Jan 1, 2015) The last 3 bytes are a random number.
HashAndSaltPassword generates a random salt, then hashes the password and the salt together, then appends the salt to the end of the hash and returns both as a base64 encoded string.
HashPassword hashes the clear-text password and encodes it as base64,.
HashPassword hashes the clear-text password and the given salt together, then appends the salt to the end of the hash and returns both as a base64 encoded string.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RandomInt returns a random integer between the two numbers.
RandomString returns a random string of letters of the given length.
No description provided by the author
SleepJobGetter decodes the SleepJob from the goque Item value.
SleepJobRunner runs the sleep job.
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
Context is used by the template.
This is a sub-struct of the Options struct.
No description provided by the author
JobScheduler manages the jobs that need to be run
.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
The main options struct.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Person represents, well, a person.
No description provided by the author
SleepJob requires public fields and public getters/setters.
No description provided by the author
No description provided by the author
WriteCounter counts the number of bytes written to it.
# Interfaces
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Job interface is implemented by the user to represent the job he wants us to run.