Beispiel #1
0
func (db *Document) Insert(ins instance.Instance) error {
	keys := []interface{}{db.Name}
	keys = append(keys, convert.Slice(ins.Attributes())...)

	_, err := db.Conn.Do("HMSET", keys...)
	return err
}
Beispiel #2
0
func TestConvert_Slice(t *testing.T) {
	attrs := instance.Attributes{
		"Name": "datagentleman",
		"Age":  31,
	}

	slice := convert.Slice(attrs)

	if len(slice) != 4 {
		t.Errorf("Want 4 got  %d\n", len(slice))
	}
}