demos

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Name = "go"

Functions

func BufferedChannel

func BufferedChannel()

func Channel

func Channel()

func Defer

func Defer() string

Defer defer类似java里的finally

func For

func For()

func FromJson

func FromJson(s string, result interface{}) interface{}

func Function

func Function(arg ...int) (int, bool)

Function

跟java一样,变参只能放在最后
注意默认是值用传递,而不是引用传递

func GetGoroutineId

func GetGoroutineId() uint64

GoroutineId 获取协程id

func GetThreadId

func GetThreadId() int

GetThreadId 获取线程id

func GoInstall

func GoInstall()

func Goroutine

func Goroutine()

func HelloWorld

func HelloWorld()

func IfElse

func IfElse()

func Json

func Json()

func MmapRead

func MmapRead(s string)

func MmapWrite

func MmapWrite()

func RealCoroutine

func RealCoroutine()

func Reflect

func Reflect(args ...interface{})

Reflect interface{}可以接手任何值,类似java的Object

func Switch

func Switch(name int)

func Tag

func Tag()

func TestNewClass

func TestNewClass()

func ThreadId

func ThreadId()

func ToJson

func ToJson(obj interface{}) string

func WaitGroup

func WaitGroup()

func Web

func Web()

Types

type Bus

type Bus struct {
	Runnable
	Stoppable
}

Bus 用组合的方式来代替继承,因此支持"多重继承"

func (*Bus) Extends

func (b *Bus) Extends()

type Class

type Class struct {
	// contains filtered or unexported fields
}

func (*Class) GetAge

func (c *Class) GetAge() int

func (*Class) GetName

func (c *Class) GetName() string

func (*Class) SetAge

func (c *Class) SetAge(age int) *Class

SetAge 支持链式调用

func (*Class) SetName

func (c *Class) SetName(name string) *Class

SetName 支持链式调用

type ClassI

type ClassI interface {
	GetName() string
	SetName(name string) *Class
}

ClassI 觉得go的接口不如java

type Runnable

type Runnable interface {
	Run()
}

type Stoppable

type Stoppable interface {
	Stop()
}

type TagTest

type TagTest struct {
	// contains filtered or unexported fields
}

type TestServiceImpl

type TestServiceImpl struct {
	Hello func(ctx context.Context, str string) (string, error)
}

type User

type User struct {
	Account  string
	Password string
}

Directories

Path Synopsis
test
test2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL