defval

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2015 License: MIT Imports: 1 Imported by: 2

Documentation

Overview

Package defval help reduce if-else block due that go has no '?:'

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolInt

func BoolInt(b bool, i *int)

BoolInt check b, set *i to 1 or 0

func BoolStr

func BoolStr(b bool, s *string)

BoolStr check b, set *s to "true" or "false"

func Int

func Int(v *int, d int)

func Int16

func Int16(v *int16, d int16)

func Int32

func Int32(v *int32, d int32)

func Int64

func Int64(v *int64, d int64)

func Int8

func Int8(v *int8, d int8)

func Nil

func Nil(i, v interface{})

Nil check whether *i is nil, if true, set *i to v, i must be a pointer

It's not recommend to use if v is get from a function call.

func String

func String(s *string, d string)

func Uint

func Uint(v *uint, d uint)

func Uint16

func Uint16(v *uint16, d uint16)

func Uint32

func Uint32(v *uint32, d uint32)

func Uint64

func Uint64(v *uint64, d uint64)

func Uint8

func Uint8(v *uint8, d uint8)

Types

type Cond

type Cond bool

func (Cond) Int

func (c Cond) Int(a, b int) int

func (Cond) Int16

func (c Cond) Int16(a, b int16) int16

func (Cond) Int32

func (c Cond) Int32(a, b int32) int32

func (Cond) Int64

func (c Cond) Int64(a, b int64) int64

func (Cond) Int8

func (c Cond) Int8(a, b int8) int8

func (Cond) String

func (c Cond) String(a, b string) string

func (Cond) Uint

func (c Cond) Uint(a, b uint) uint

func (Cond) Uint16

func (c Cond) Uint16(a, b uint16) uint16

func (Cond) Uint32

func (c Cond) Uint32(a, b uint32) uint32

func (Cond) Uint64

func (c Cond) Uint64(a, b uint64) uint64

func (Cond) Uint8

func (c Cond) Uint8(a, b uint8) uint8

Jump to

Keyboard shortcuts

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