-
Notifications
You must be signed in to change notification settings - Fork 0
Home
iFurySt edited this page Jul 28, 2023
·
9 revisions
Welcome to the 👾 lol wiki!
Just for convenience, you create the pointer to a Boolean value on one line.
package main
import (
"github.com/ifuryst/lol"
"net"
)
type IP struct {
Address string
Status *bool
}
func main() {
s := IP{
Address: net.ParseIP("8.8.8.8").String(),
Status: lol.NewFalse(),
}
// do sth
_ = s
}
Get the all keys in the map struct.
package main
import (
"fmt"
"github.com/ifuryst/lol"
)
func main() {
users := map[string]int{
"Jack": 18,
"Tom": 21,
"Heisenberg": 48,
}
fmt.Println(lol.Keys(users))
// Output:
// [Jack Tom Heisenberg]
}
Get the all values in the map struct.
package main
import (
"fmt"
"github.com/ifuryst/lol"
)
func main() {
users := map[string]int{
"Jack": 18,
"Tom": 21,
"Heisenberg": 48,
}
fmt.Println(lol.Values(users))
// Output:
// [18 21 48]
}
Get the absolute value of the given number.
package main
import (
"fmt"
"github.com/ifuryst/lol"
)
func main() {
n := -3
fmt.Println(lol.Abs(n))
// Output:
// 3
}
Get the maximum or minimum number from the given numbers.
package main
import (
"fmt"
"github.com/ifuryst/lol"
)
func main() {
i, j := -3, 3
fmt.Println(lol.Max(i, j))
fmt.Println(lol.Min(i, j))
// Output:
// 3
// -3
}