Skip to content

Instantly share code, notes, and snippets.

@aaronstaves
aaronstaves / example_methods.go
Created June 5, 2020 14:55
Go methods vs funcs - methods
// MyHandler Defintion
type MyHandler struct {
newrelic *newrelic.Application
configuration *configuration.Configuration
myService *sling.Sling
myDB dynamo.IClient
}
//New MyHandler constructor
func NewMyHandler(newrelic *newrelic.Application, config *configuration.Configuration, service *sling.Sling, db dynamo.IClient) *BuilderMessageHandler {
@aaronstaves
aaronstaves / example_funcs.go
Created June 5, 2020 14:58
Go methods vs funcs - funcs
func DoDBThing(newrelic *newrelic.Application, myDB dynamo.IClient, querythinger string) error {
newrelic.txn() // whatever
myDB.query(querythinger, s.newrelic)
}
func DoServiceThing(newrelic *newrelic.Application, myService *sling.Sling, querythinger string) error {
newrelic.txn() // whatever
myService.Do(querythinger, newrelic)
}