-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new conversion rate and custom metric fields, added missing eve…
…nt meta, timezone, offset, sort, direction, and search fields in filter, removed screen_width and screen_height from filter.
- Loading branch information
1 parent
b3d4f98
commit ed55a9e
Showing
5 changed files
with
200 additions
and
64 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
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
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,31 @@ | ||
package pkg | ||
|
||
import ( | ||
"database/sql/driver" | ||
"encoding/json" | ||
"errors" | ||
) | ||
|
||
// KeyValue is a key value map that can be stored as jsonb. | ||
type KeyValue map[string]string | ||
|
||
func (kv *KeyValue) Value() (driver.Value, error) { | ||
return json.Marshal(kv) | ||
} | ||
|
||
func (kv *KeyValue) Scan(value interface{}) error { | ||
var data []byte | ||
|
||
switch v := value.(type) { | ||
case string: | ||
data = []byte(v) | ||
case []byte: | ||
data = v | ||
case nil: | ||
return nil | ||
default: | ||
return errors.New("type assertion failed") | ||
} | ||
|
||
return json.Unmarshal(data, &kv) | ||
} |
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