Logic for saving handshakejs data to the redis database.
This library is part of the larger Handshake.js ecosystem.
package main
import (
"fmt"
"github.com/handshakejs/handshakejslogic"
)
func main() {
handshakejslogic.Setup("redis://127.0.0.1:6379", handshakejslogic.Options{})
app := map[string]interface{}{"email": "email@myapp.com", "app_name": "myapp"}
result, logic_error := handshakejslogic.AppsCreate(app)
if logic_error != nil {
fmt.Println(logic_error)
}
fmt.Println(result)
}
Connects to Redis.
options := handshakejslogic.Options{}
handshakejslogic.Setup("redis://127.0.0.1.6379", options)
app := map[string]interface{}{"email": "email@myapp.com", "app_name": "myapp"}
result, logic_error := handshakejslogic.AppsCreate(app)
identity := map[string]interface{}{"email": "user@email.com", "app_name": "myapp"}
result, logic_error := handshakejslogic.IdentitiesCreate(identity)
go get github.com/handshakejs/handshakejslogic
go test -v
Handshakejslogic uses a purposely simple database schema - as simple as possible. If you know a simpler approach, even better, please let me know or share as a pull request.
Handshakejslogic uses Redis because of its light footprint, ephemeral nature, and lack of migrations.
- apps - collection of keys with all the app_names in there. SADD
- apps/myappname - hash with all the data in there. HSET or HMSET
- apps/theappname/identities - collection of keys with all the identities' emails in there. SADD
- apps/theappname/identities/emailaddress HSET or HMSET