This file contains hidden or 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
Execute SQL statements from a file | |
Suppose we have a file named commands.txtin the c:\sqlite\folder with the following content: | |
``` | |
SELECT albumid, title | |
FROM albums | |
ORDER BY title | |
LIMIT 10; |
This file contains hidden or 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
// GO: Convert a string to JSON | |
// Input: string | |
// Output:JSON if OK, nil otherwise | |
// | |
func stringToJSON (sourceString string) []byte { | |
var obj map[string]interface{} | |
err := json.Unmarshal([]byte(sourceString), &obj) | |
if err != nil { | |
fmt.Println(err) | |
return nil |
This file contains hidden or 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
// GO: Convert a structure to a string | |
// Input: interface{} | |
// Output: (string, nil) if OK, ("", error) otherwise | |
// | |
func structToString (sourceStruct interface{}) (string, error) { | |
sourceJson, error := json.Marshal(sourceStruct) | |
if error != nil { | |
return "", error | |
} | |
return string(sourceJson), nil |
This file contains hidden or 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
/* | |
* ***************************************************************************** | |
* GIST used to configure a typed React Redux component | |
* https://redux.js.org/recipes/usage-with-typescript/#usage-with-typescript | |
* ***************************************************************************** | |
*/ | |
// Comment out if not used | |
// interface OwnProps { | |
// } |