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.
17 // This source code is part of the near-RT RIC (RAN Intelligent Controller)
18 // platform project (RICP).
29 sdl1 := sdl.Create("test1")
33 err = sdl1.Set("key1", "data1", "key2", "data2")
35 fmt.Printf("unable to write to DB\n")
38 err = sdl1.Set("num1", 1, "num2", 2)
40 fmt.Printf("unable to write to DB\n")
47 err = sdl1.Set("arr1", d)
49 fmt.Printf("unable to write to DB\n")
52 p := []string{"pair1", "data1", "pair2", "data2"}
55 fmt.Printf("unable to write to DB\n")
58 a := [4]string{"array1", "adata1", "array2", "adata2"}
61 fmt.Printf("unable to write to DB\n")
64 mix1 := []interface{}{"mix1", "data1", "mix2", 2}
67 fmt.Printf("unable to write to DB\n")
70 mix2 := [4]interface{}{"mix3", "data3", "mix4", 4}
73 fmt.Printf("unable to write to DB\n")
76 _, err = sdl1.SetIf("key1", "data1", "data2")
78 fmt.Printf("unable to write to DB\n")
81 retDataMap, err := sdl1.Get([]string{"key1", "key3", "key2"})
83 fmt.Printf("Unable to read from DB\n")
85 for i, v := range retDataMap {
86 fmt.Printf("%s:%s\n", i, v)
90 retDataMap2, err := sdl1.Get([]string{"num1", "num2"})
92 fmt.Printf("Unable to read from DB\n")
94 for i, v := range retDataMap2 {
95 fmt.Printf("%s:%s\n", i, v)
99 fmt.Println("-------------")
100 allKeys := []string{"key1", "key2", "num1", "num2", "pair1", "pair2", "array1", "array2", "mix1", "mix2", "mix3", "mix4", "arr1"}
101 retDataMap3, err := sdl1.Get(allKeys)
103 fmt.Printf("Unable to read from DB\n")
105 for i3, v3 := range retDataMap3 {
106 fmt.Printf("%s:%s\n", i3, v3)