@@ -127,6 +127,98 @@ func ExampleConnection_SelectAsync() {
127127 // Future 2 Data [[18 val 18 bla]]
128128}
129129
130+ func ExampleConnection_GetTyped () {
131+ conn := example_connect ()
132+ defer conn .Close ()
133+
134+ const space = "test"
135+ const index = "primary"
136+ conn .Replace (space , []interface {}{uint (1111 ), "hello" , "world" })
137+
138+ var t Tuple
139+ err := conn .GetTyped (space , index , []interface {}{1111 }, & t )
140+ fmt .Println ("Error" , err )
141+ fmt .Println ("Data" , t )
142+ // Output:
143+ // Error <nil>
144+ // Data {{} 1111 hello world}
145+ }
146+
147+ func ExampleIntKey () {
148+ conn := example_connect ()
149+ defer conn .Close ()
150+
151+ const space = "test"
152+ const index = "primary"
153+ conn .Replace (space , []interface {}{int (1111 ), "hello" , "world" })
154+
155+ var t Tuple
156+ err := conn .GetTyped (space , index , tarantool.IntKey {1111 }, & t )
157+ fmt .Println ("Error" , err )
158+ fmt .Println ("Data" , t )
159+ // Output:
160+ // Error <nil>
161+ // Data {{} 1111 hello world}
162+ }
163+
164+ func ExampleUintKey () {
165+ conn := example_connect ()
166+ defer conn .Close ()
167+
168+ const space = "test"
169+ const index = "primary"
170+ conn .Replace (space , []interface {}{uint (1111 ), "hello" , "world" })
171+
172+ var t Tuple
173+ err := conn .GetTyped (space , index , tarantool.UintKey {1111 }, & t )
174+ fmt .Println ("Error" , err )
175+ fmt .Println ("Data" , t )
176+ // Output:
177+ // Error <nil>
178+ // Data {{} 1111 hello world}
179+ }
180+
181+ func ExampleStringKey () {
182+ conn := example_connect ()
183+ defer conn .Close ()
184+
185+ const space = "teststring"
186+ const index = "primary"
187+ conn .Replace (space , []interface {}{"any" , []byte {0x01 , 0x02 }})
188+
189+ t := struct {
190+ Key string
191+ Value []byte
192+ }{}
193+ err := conn .GetTyped (space , index , tarantool.StringKey {"any" }, & t )
194+ fmt .Println ("Error" , err )
195+ fmt .Println ("Data" , t )
196+ // Output:
197+ // Error <nil>
198+ // Data {any [1 2]}
199+ }
200+
201+ func ExampleIntIntKey () {
202+ conn := example_connect ()
203+ defer conn .Close ()
204+
205+ const space = "testintint"
206+ const index = "primary"
207+ conn .Replace (space , []interface {}{1 , 2 , "foo" })
208+
209+ t := struct {
210+ Key1 int
211+ Key2 int
212+ Value string
213+ }{}
214+ err := conn .GetTyped (space , index , tarantool.IntIntKey {1 , 2 }, & t )
215+ fmt .Println ("Error" , err )
216+ fmt .Println ("Data" , t )
217+ // Output:
218+ // Error <nil>
219+ // Data {1 2 foo}
220+ }
221+
130222func ExampleSelectRequest () {
131223 conn := example_connect ()
132224 defer conn .Close ()
0 commit comments