Reduce repeated code in pcsdk module

This commit is contained in:
Erik
2023-05-02 15:27:43 +02:00
parent 29e45d58e1
commit f6cb03e2da
5 changed files with 98 additions and 132 deletions

View File

@ -10,11 +10,11 @@ import (
)
func main() {
proxy := pcsdk.BuildProxy(netip.MustParseAddrPort("127.0.0.1:14000"))
ip := netip.MustParseAddr("127.0.0.1")
uuid := uuid.MustParse("87e79cbc-6df6-4462-8412-85d6c473e3b1")
m := pcsdk.NewCommandCreate(5555, 8080, ip, state.CustomUUID(uuid))
err := m.Execute(netip.MustParseAddrPort("127.0.0.1:3000"))
err := proxy.Create(5555, 8080, ip, state.CustomUUID(uuid))
if err != nil {
fmt.Printf("error executing create command: %s\n", err)
} else {

View File

@ -10,10 +10,10 @@ import (
)
func main() {
proxy := pcsdk.BuildProxy(netip.MustParseAddrPort("127.0.0.1:14000"))
uuid := uuid.MustParse("87e79cbc-6df6-4462-8412-85d6c473e3b1")
m := pcsdk.NewCommandDelete(state.CustomUUID(uuid))
err := m.Execute(netip.MustParseAddrPort("127.0.0.1:3000"))
err := proxy.Delete(state.CustomUUID(uuid))
if err != nil {
fmt.Printf("error executing delete command: %s\n", err)
} else {

View File

@ -10,11 +10,11 @@ import (
)
func main() {
proxy := pcsdk.BuildProxy(netip.MustParseAddrPort("127.0.0.1:14000"))
ip := netip.MustParseAddr("127.0.0.1")
uuid := uuid.MustParse("87e79cbc-6df6-4462-8412-85d6c473e3b1")
m := pcsdk.NewCommandModify(9111, ip, state.CustomUUID(uuid))
err := m.Execute(netip.MustParseAddrPort("127.0.0.1:3000"))
err := proxy.Modify(9111, ip, state.CustomUUID(uuid))
if err != nil {
fmt.Printf("error executing modify command: %s\n", err)
} else {