github.com/LagrangeDev/LagrangeGo@v0.0.0-20240512064304-ad4a85e10cb4/utils/operator.go (about)

     1  package utils
     2  
     3  import (
     4  	"bufio"
     5  	"fmt"
     6  	"os"
     7  	"strings"
     8  	"time"
     9  )
    10  
    11  func TimeStamp() int64 {
    12  	return time.Now().Unix()
    13  }
    14  
    15  func ReadLine(s string) string {
    16  	inputReader := bufio.NewReader(os.Stdin)
    17  	fmt.Print(s)
    18  	rs, err := inputReader.ReadString('\n')
    19  	if err != nil {
    20  		panic(err)
    21  	}
    22  	return strings.TrimSpace(rs)
    23  }
    24  
    25  func Bool2Int(v bool) int {
    26  	if v {
    27  		return 1
    28  	}
    29  	return 0
    30  }