gitlab.com/evatix-go/core@v1.3.55/cmd/main/coreDynamicMapAnyItems.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "gitlab.com/evatix-go/core/coredata/coredynamic" 7 "gitlab.com/evatix-go/core/coredata/corejson" 8 "gitlab.com/evatix-go/core/coredata/corestr" 9 "gitlab.com/evatix-go/core/errcore" 10 "gitlab.com/evatix-go/core/namevalue" 11 ) 12 13 func coreDynamicMapAnyItems() { 14 fmt.Println(errcore.VarTwoNoType("s1", "ss", "s2", 2)) 15 fmt.Println(errcore.MessageVarTwo("current message", "s1", "ss", "s2", 2)) 16 fmt.Println(errcore.MessageVarMap( 17 "current message", 18 map[string]interface{}{ 19 "key1": 1, 20 "key2": 1, 21 "key3": "", 22 })) 23 24 fmt.Println(errcore.MessageNameValues( 25 "current message", 26 namevalue.Instance{ 27 Name: "name1", 28 Value: "nil", 29 }, 30 namevalue.Instance{ 31 Name: "name2", 32 Value: 2, 33 })) 34 35 fmt.Println("MapAnyItems") 36 mapAnyItems := coredynamic.NewMapAnyItems(200) 37 collection := corestr.New.Collection.Cap(100) 38 collection.Adds("alim-1", "alim-2", "alim-3", "alim-4") 39 mapAnyItems.Add("alim-something", collection) 40 mapAnyItems.Add("alim-something2", collection) 41 mapAnyItems.Add("alim-something3", collection.ConcatNew(1, "alim 5")) 42 mapAnyItems.Add("alim-something4", collection) 43 mapAnyItems.Add("alim-something5", collection) 44 mapAnyItems.Add("alim-something6", collection) 45 mapAnyItems.Add("alim-something7", collection) 46 mapAnyItems.Add("alim-something8", collection) 47 mapAnyItems.Add("alim-something9", collection) 48 49 splittedItems := mapAnyItems.GetPagedCollection(2) 50 51 for _, splittedItem := range splittedItems { 52 fmt.Println(splittedItem.AllKeys()) 53 } 54 55 jsonResult := mapAnyItems.JsonPtr() 56 emptyCollection4 := corestr.Empty.Collection() 57 mapAnyItems.GetItemRef("alim-something3", emptyCollection4) 58 fmt.Println("4", emptyCollection4) 59 60 emptyMapAnyItems := coredynamic.EmptyMapAnyItems() 61 emptyCollection3 := corestr.Empty.Collection() 62 req := corejson.KeyAny{ 63 Key: "alim-something3", 64 AnyInf: emptyCollection3, 65 } 66 67 err := emptyMapAnyItems.JsonParseSelfInject(jsonResult) 68 newJsonResult := emptyMapAnyItems.Json() 69 fmt.Println(err) 70 collectionJsonResult := emptyMapAnyItems.JsonResultOfKey("alim-something") 71 72 err2 := emptyMapAnyItems.GetManyItemsRefs(req) 73 fmt.Println("alim-something3, err:", err2) 74 fmt.Println("\"alim-something3\":", req.AnyInf) 75 fmt.Println("\"alim-something3\":", emptyCollection3) 76 77 err3 := emptyMapAnyItems.GetUsingUnmarshallManyAt(req) 78 fmt.Println("alim-something3, err:", err3) 79 fmt.Println("\"alim-something3\":", req.AnyInf) 80 fmt.Println("\"alim-something3\":", emptyCollection3) 81 82 fmt.Println(jsonResult.JsonString()) 83 fmt.Println(newJsonResult.JsonString()) 84 fmt.Println("jsonResult == newJsonResult :", jsonResult.IsEqual(newJsonResult)) 85 fmt.Println(collectionJsonResult.JsonString()) 86 newLinkedList := corestr.Empty.LinkedList() 87 88 newLinkedList.JsonParseSelfInject(collectionJsonResult) 89 fmt.Println(newLinkedList) 90 fmt.Println(mapAnyItems) 91 92 anyCollection := coredynamic.NewAnyCollection(10) 93 anyCollection.AddAnySliceFromSingleItem(splittedItems[0].AllKeys()) 94 fmt.Println(anyCollection) 95 }