Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Variadic helper to mimic named arguments.

License

NotificationsYou must be signed in to change notification settings

danielgatis/go-keyval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report CardLicense MITGo Doc

A Variadic helper to mimic named arguments.

Install

go get -u github.com/danielgatis/go-keyval

And then import the package in your code:

import"github.com/danielgatis/go-keyval"

Example

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 ...}

License

Copyright (c) 2020-presentDaniel Gatis

Licensed underMIT License

About

A Variadic helper to mimic named arguments.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp