You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
1.6 KiB
85 lines
1.6 KiB
package nhooyrioWebsocketAddons
|
|
|
|
//Funktionierender Mustercode
|
|
|
|
/* //Alt: Ohne Pointer
|
|
|
|
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"zmpTmp/nh"
|
|
)
|
|
|
|
var buffer nh.GosmAdapter
|
|
var container nh.GosmAdapter
|
|
|
|
func main() {
|
|
container = &nh.GosmContainer{nh.GosmContainerSection{"A", "BB", "CCC", true, "DDDD"}, nh.GosmContainerSection{"D", "EE", "FFF", false, "GGGG"}}
|
|
buffer, _ = container.Convert()
|
|
|
|
fmt.Printf("%T\n", buffer)
|
|
|
|
//buffer.Revalue()
|
|
|
|
fmt.Println(buffer)
|
|
|
|
newContainer, _ := buffer.Convert()
|
|
//newContainer.Revalue()
|
|
fmt.Printf("%T\n", newContainer)
|
|
fmt.Println(newContainer)
|
|
|
|
j, err := json.Marshal(container)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(j)
|
|
}
|
|
*/
|
|
|
|
/* //Neu: Mit Pointer
|
|
|
|
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
//"zmpTmp/nh"
|
|
nh "git.archium.org/archium_public/ebkTools/nhooyrioWebsocketAddons"
|
|
)
|
|
|
|
var buffer nh.GosmAdapter
|
|
var container nh.GosmAdapter
|
|
|
|
func main() {
|
|
container = &nh.GosmContainer{nh.GosmContainerSection{"A", "BB", "CCC", true, "DDDD"}, nh.GosmContainerSection{"D", "EE", "FFF", false, "GGGG"}}
|
|
|
|
fmt.Println(container)
|
|
|
|
container.Revalue(func(interface{}) interface{} {
|
|
return nh.GosmContainer{nh.GosmContainerSection{"Aneu", "BBneu", "CCCneu", true, "DDDDneu"}, nh.GosmContainerSection{"Dneu", "EEneu", "FFFneu", false, "GGGGneu"}}
|
|
})
|
|
|
|
buffer, _ = container.Convert()
|
|
|
|
fmt.Printf("%T\n", buffer)
|
|
|
|
puffer := buffer.(*nh.GosmBuffer)
|
|
fmt.Println(*puffer)
|
|
|
|
newContainer, _ := buffer.Convert()
|
|
fmt.Printf("%T\n", newContainer)
|
|
fmt.Println(newContainer)
|
|
fmt.Println(container)
|
|
|
|
j, err := json.Marshal(container)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(j)
|
|
|
|
}
|
|
|
|
*/
|
|
|