-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
7 changed files
with
835 additions
and
0 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 |
---|---|---|
|
@@ -10,3 +10,6 @@ | |
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# GoLand | ||
.idea |
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,88 @@ | ||
package dsmock | ||
|
||
type TypeStyle string | ||
|
||
const ( | ||
KeywordKey = "__key__" | ||
KeywordCurrent = "__current__" | ||
KeywordNoIndex = "__noindex__" | ||
KeywordNoIndexValue = "noindex" | ||
|
||
KeywordString = "__string__" | ||
KeywordDatetime = "__datetime__" | ||
KeywordInteger = "__integer__" | ||
KeywordInt = "__int__" | ||
KeywordFloat = "__float__" | ||
KeywordBoolean = "__boolean__" | ||
KeywordBool = "__bool__" | ||
KeywordGeo = "__geo__" | ||
KeywordArray = "__array__" | ||
KeywordEmbed = "__embed__" | ||
KeywordBlob = "__blob__" | ||
KeywordNull = "__null__" | ||
) | ||
|
||
type DatastoreType string | ||
|
||
const ( | ||
TypeString = DatastoreType("string") | ||
TypeDatetime = DatastoreType("datetime") | ||
TypeInteger = DatastoreType("integer") | ||
TypeInt = DatastoreType("int") | ||
TypeFloat = DatastoreType("float") | ||
TypeBoolean = DatastoreType("boolean") | ||
TypeBool = DatastoreType("bool") | ||
TypeKey = DatastoreType("key") | ||
TypeGeo = DatastoreType("geo") | ||
TypeArray = DatastoreType("array") | ||
TypeEmbed = DatastoreType("embed") | ||
TypeBlob = DatastoreType("blob") | ||
TypeNull = DatastoreType("null") | ||
TypeNil = DatastoreType("<nil>") | ||
) | ||
|
||
var ( | ||
keywordTypeMap = map[string]DatastoreType{ | ||
KeywordString: TypeString, | ||
KeywordDatetime: TypeDatetime, | ||
KeywordInteger: TypeInteger, | ||
KeywordInt: TypeInt, | ||
KeywordFloat: TypeFloat, | ||
KeywordBoolean: TypeBoolean, | ||
KeywordBool: TypeBool, | ||
KeywordKey: TypeKey, | ||
KeywordGeo: TypeGeo, | ||
KeywordArray: TypeArray, | ||
KeywordEmbed: TypeEmbed, | ||
KeywordBlob: TypeBlob, | ||
KeywordNull: TypeNull, | ||
} | ||
|
||
typeKeywordMap = map[DatastoreType]string{ | ||
TypeString: KeywordString, | ||
TypeDatetime: KeywordDatetime, | ||
TypeInteger: KeywordInteger, | ||
TypeInt: KeywordInt, | ||
TypeFloat: KeywordFloat, | ||
TypeBoolean: KeywordBoolean, | ||
TypeBool: KeywordBool, | ||
TypeKey: KeywordKey, | ||
TypeGeo: KeywordGeo, | ||
TypeArray: KeywordArray, | ||
TypeEmbed: KeywordEmbed, | ||
TypeBlob: KeywordBlob, | ||
TypeNull: KeywordNull, | ||
} | ||
) | ||
|
||
func IsKeyValueName(name string) bool { | ||
return name == KeywordKey | ||
} | ||
|
||
func IsCurrentDatetime(name string) bool { | ||
return name == KeywordCurrent | ||
} | ||
|
||
func IsNoIndex(value string) bool { | ||
return value == KeywordNoIndexValue | ||
} |
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,11 @@ | ||
package dsmock | ||
|
||
import "context" | ||
|
||
func InsertMockData(ctx context.Context, filename string) error { | ||
err := Upsert(ctx, filename) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
Oops, something went wrong.