pattern

package
v0.0.0-...-385762f Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendString

func AppendString() string

字符串string buffer and string bulder

func DeepCompare

func DeepCompare()

这个对象可以是内建数据类型,数组,结构体,map……我们在复制结构体的时候,当我们需要比较两个结构体中的数据是否相同时, 我们需要使用深度比较,而不是只是简单地做浅度比较

func GetArr

func GetArr() (result []int64)

func GetInt2String

func GetInt2String(num int) string

数字转字符串

func GetSquare

func GetSquare()

直接使用Square类型

func GetString2Int

func GetString2Int(num string) (int, error)

字符串转数字

func GetTimeString

func GetTimeString() string

time

func GoInterface

func GoInterface()

func GoSlice

func GoSlice()

Slice 分片设置需要注意内存申请分配

func PrintToString

func PrintToString(s GoString)

Types

type Country

type Country struct {
	Name string
}

func (Country) ToString

func (c Country) ToString() string

type GoString

type GoString interface {
	ToString() string
}

接口编程

type Region

type Region struct {
	Name string
}

func (Region) ToString

func (r Region) ToString() string

type Shape

type Shape interface {
	Sides() int
	Area() int
}

接口完整性检查

func GetShape

func GetShape() (Shape, error)

获取Shape类型

type Square

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

func (*Square) Area

func (s *Square) Area() int

func (*Square) Sides

func (s *Square) Sides() int

Square 没有全部实现Shape接口,如果需要强制Square实现所有的Shape接口,则需要进行以下定义

Jump to

Keyboard shortcuts

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