Categorygithub.com/yingshaoxo/gopython
module
0.0.0-20230428070706-d87c99c5046a
Repository: https://github.com/yingshaoxo/gopython.git
Documentation: pkg.go.dev

# README

gopython

Let you write go as if you were writing Python.

Golang is garbage, you'd better use Python for your safety.

You may want to kill yourself at sometimes if you persistent to use Golang.

Usage

go get github.com/yingshaoxo/gopython

Try-Catch

package main

import (
	"log"
	"fmt"

	error_tool "github.com/yingshaoxo/gopython/error_tool"
)

func main() {
	error_tool.Try(func() {
		i := 3
		for i != -1 {
			result := 100 / i
			fmt.Println(result, i)

			i -= 1
		}
	}).Catch(func(err string) {
		log.Println(err)
	})
}

Nullable

package main

import (
	"fmt"

	variable_tool "github.com/yingshaoxo/gopython/variable_tool"
)

func main() {
	hi := "hi"
	ok := "ok"

	a_string := variable_tool.Nullable(&hi)
	a_string.Is_null = true
	fmt.Println(*a_string.Value)
	fmt.Println(a_string.Is_null)

	a_string.Value = &ok
	a_string.Is_null = false
	fmt.Println(*a_string.Value)
	fmt.Println(a_string.Is_null)
}

JWT (json web token)

package main

import (
	"log"

	jwt_tool "github.com/yingshaoxo/gopython/jwt_tool"
)

func main() {
	secret := "no way"

	data := make(map[string]interface{})
	data["user"] = "yingshaoxo"

	jwt_string := jwt_tool.Jwt_encode(data, secret)
	log.Println(jwt_string)

	new_data, _ := jwt_tool.Jwt_decode(jwt_string, secret)

	log.Println(data)
	log.Println(new_data)
}

Network

package main

import (
	"log"

	port_scanner "github.com/yingshaoxo/gopython/network"
)

func main() {
	urls := port_scanner.ScanPorts("localhost", 0, 65535)
	log.Println(urls)
}

# Packages

We implement python built-in functions here.
We use this package to handle databases.
We handle dictionary/map/key-value related problems here.
We do disk(storage) related work here.
We handle error related work here.
We handle function related work here.
We do json operations here.
We handle json web token related problems here.
We handle list/array related problems here.
We use this package to do port scanning for a host or many hosts.
We handle network related problems here.
We do safe math here, for example, handle big numbers for financial problems.
We handle string related problems here.
We handle terminal/bash/shell problems here.
No description provided by the author
We handle time related problems here.
We handle variable related problems here, for example, is the variable nullable.