cexp

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: MIT Imports: 0 Imported by: 0

README

cexp

Get value by condition. It likes :?.

package main

import (
	"log"

	"github.com/QisFj/godry/cexp"
)

func main(){
    // won't panic, would print "false", 
    log.Print(cexp.StringShortCircuit(false,
    	func() string {
    	    panic("! not short circuit !")
    	},
    	func() string {
    		return "false"
    	},
    ))
}

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int

func Int(condition bool, v1, v2 int) int

func IntShortCircuit

func IntShortCircuit(condition bool, g1, g2 IntGetter) int

func Interface

func Interface(condition bool, v1, v2 interface{}) interface{}

func InterfaceShortCircuit

func InterfaceShortCircuit(condition bool, g1, g2 InterfaceGetter) interface{}

func String

func String(condition bool, v1, v2 string) string

func StringShortCircuit

func StringShortCircuit(condition bool, g1, g2 StringGetter) string

func Uint

func Uint(condition bool, v1, v2 uint) uint

func UintShortCircuit

func UintShortCircuit(condition bool, g1, g2 UintGetter) uint

Types

type IntGetter

type IntGetter func() int

type InterfaceGetter

type InterfaceGetter func() interface{}

type StringGetter

type StringGetter func() string

type UintGetter

type UintGetter func() uint

Jump to

Keyboard shortcuts

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