- Notifications
You must be signed in to change notification settings - Fork0
A Variadic helper to mimic named arguments.
License
NotificationsYou must be signed in to change notification settings
danielgatis/go-keyval
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Variadic helper to mimic named arguments.
go get -u github.com/danielgatis/go-keyval
And then import the package in your code:
import"github.com/danielgatis/go-keyval"
An example described below is one of the use cases.
package mainimport ("fmt""time""github.com/danielgatis/go-keyval")funcmain() {now:=time.Now().UTC()email:="johndoe@gmail.com"query:="select * from users where email = :email and created_at < :created_at"execNamed(query,"email",email,"created_at",now)}funcexecNamed(querystring,args...interface{}) {m:=keyval.ToMap(args...)fmt.Printf("%s",m["email"])fmt.Printf("%s",m["created_at"])// db stuff here ...}
Copyright (c) 2020-presentDaniel Gatis
Licensed underMIT License
About
A Variadic helper to mimic named arguments.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.