1 // Copyright (c) 2019 AT&T Intellectual Property.
2 // Copyright (c) 2019 Nokia.
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
24 sdl1 := sdl.Create("test1")
28 err = sdl1.Set("key1", "data1", "key2", "data2")
30 fmt.Printf("unable to write to DB\n")
33 err = sdl1.Set("num1", 1, "num2", 2)
35 fmt.Printf("unable to write to DB\n")
42 err = sdl1.Set("arr1", d)
44 fmt.Printf("unable to write to DB\n")
47 p := []string{"pair1", "data1", "pair2", "data2"}
50 fmt.Printf("unable to write to DB\n")
53 a := [4]string{"array1", "adata1", "array2", "adata2"}
56 fmt.Printf("unable to write to DB\n")
59 mix1 := []interface{}{"mix1", "data1", "mix2", 2}
62 fmt.Printf("unable to write to DB\n")
65 mix2 := [4]interface{}{"mix3", "data3", "mix4", 4}
68 fmt.Printf("unable to write to DB\n")
71 retDataMap, err := sdl1.Get([]string{"key1", "key3", "key2"})
73 fmt.Printf("Unable to read from DB\n")
75 for i, v := range retDataMap {
76 fmt.Printf("%s:%s\n", i, v)
80 retDataMap2, err := sdl1.Get([]string{"num1", "num2"})
82 fmt.Printf("Unable to read from DB\n")
84 for i, v := range retDataMap2 {
85 fmt.Printf("%s:%s\n", i, v)
89 fmt.Println("-------------")
90 allKeys := []string{"key1", "key2", "num1", "num2", "pair1", "pair2", "array1", "array2", "mix1", "mix2", "mix3", "mix4", "arr1"}
91 retDataMap3, err := sdl1.Get(allKeys)
93 fmt.Printf("Unable to read from DB\n")
95 for i3, v3 := range retDataMap3 {
96 fmt.Printf("%s:%s\n", i3, v3)