Browse Source

Etwas Beispiel-Code in doc.go

test
Klaus Wendel 2 years ago
parent
commit
6ee0eee95e
  1. 85
      nhooyrioWebsocketAddons/doc.go

85
nhooyrioWebsocketAddons/doc.go

@ -0,0 +1,85 @@
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)
}
*/
Loading…
Cancel
Save