Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gustavo Chain
committed
Jun 2, 2016
1 parent
1c1f270
commit be15218
Showing
3 changed files
with
75 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package sqlhooks | ||
|
||
type Context struct { | ||
Error error | ||
Query string | ||
Args []interface{} | ||
|
||
values map[string]interface{} | ||
} | ||
|
||
func NewContext() *Context { | ||
return &Context{} | ||
} | ||
|
||
func (ctx *Context) Get(key string) interface{} { | ||
if ctx.values == nil { | ||
ctx.values = make(map[string]interface{}) | ||
} | ||
|
||
if v, ok := ctx.values[key]; ok { | ||
return v | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (ctx *Context) Set(key string, value interface{}) { | ||
if ctx.values == nil { | ||
ctx.values = make(map[string]interface{}) | ||
} | ||
|
||
ctx.values[key] = value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters