style

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: 4 Imported by: 0

Documentation

Overview

包的命名规范:短,简洁,容易记住 go推荐的命名方式为src/encoding/base64 而非src/encoding_base64或者是src/encodingBase64 参考wiki: https://golang.org/doc/effective_go.html

Index

Constants

This section is empty.

Variables

View Source
var (
	IllegalErr = errors.New("the parameter is illegal err")
)

declare err expression

Functions

This section is empty.

Types

type IServer

type IServer interface {
	Start(address string, port int32)
	Run()
	Stop()
}

interface name use methodName with suffix er,for example:

type Server

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

func (*Server) Port

func (s *Server) Port() (port int32)

func (*Server) Run

func (s *Server) Run() (err error)

func (*Server) SetPort

func (s *Server) SetPort(port int32) (err error)

如果对象有必要使用到getter以及setter方法的时候,需要使用以下方式来命名 setter & getter 定义对象的方法,要传递对象的指针引用,因为使用指针引用需要改变对象的属性值,传递值引用是无法改变对象的属性值

func (*Server) Start

func (s *Server) Start(address string, port int32) (res bool, err error)

method desc here Server start method with address and port if find comment could be used as follow: go doc -all start | grep -i start

func (*Server) State

func (s *Server) State() int32

func (*Server) UseFor

func (s *Server) UseFor() (err error)

func (*Server) UseIf

func (s *Server) UseIf() (err error)

func (*Server) UseSwitch

func (s *Server) UseSwitch(a []int, b []int) (res int)

func (*Server) UseSwitchType

func (s *Server) UseSwitchType()

Jump to

Keyboard shortcuts

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