setter

package
v1.8.6 Latest Latest
Warning

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

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

README

setter 设置值

用于处理各种操蛋的代码,比如

if "" != server.Options.Password {
serverOptions.SetPassword(server.Options.Password)
} else {
serverOptions.SetPassword(mqttConfig.Options.Password)
}

经过简单的setter后,可以写成如下格式

setter.String(serverOptions.SetPassword, server.Options.Password, mqttConfig.Options.Password)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(setter boolSetter, value bool, null bool)

Bool 设置布尔值

func BoolX

func BoolX(setter boolSetter, value bool)

BoolX 当有值时设置布尔值

func Duration

func Duration(setter durationSetter, value time.Duration, null time.Duration)

Duration 设置时间段

func DurationX

func DurationX(setter durationSetter, value time.Duration)

DurationX 设置时间段

func Int32

func Int32(setter int32Setter, value int32, null int32)

Int32 设置字符串

func Int32X

func Int32X(setter int32Setter, value int32)

Int32X 当有值时设置字符串

func Int64

func Int64(setter int64Setter, value int64, null int64)

Int64 设置整数值

func Int64X

func Int64X(setter int64Setter, value int64)

Int64X 当有值时设置整数值

func Int8

func Int8(setter int8Setter, value int8, null int8)

Int8 设置字符串

func Int8X

func Int8X(setter int8Setter, value int8)

Int8X 当有值时设置字符串

func String

func String(setter stringSetter, value string, null string)

String 设置字符串

func StringX

func StringX(setter stringSetter, value string)

StringX 当有值时设置字符串

Types

This section is empty.

Jump to

Keyboard shortcuts

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