Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
kokizzu committed Nov 23, 2021
1 parent 3aea692 commit e1361c3
Show file tree
Hide file tree
Showing 15 changed files with 2,629 additions and 68 deletions.
143 changes: 143 additions & 0 deletions A/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# A
--
import "gotro/A"


## Usage

#### func FloatExist

```go
func FloatExist(arr []float64, val float64) bool
```
check if float exists on array

#### func IntAppendIfNotExists

```go
func IntAppendIfNotExists(arr []int64, str int64) []int64
```
Append if not exists

#### func IntContains

```go
func IntContains(arr []int64, str int64) bool
```
Append int64 to array of string if not exists

#### func IntJoin

```go
func IntJoin(arr []int64, sep string) string
```
combine int64s in the array of int64 with the chosen string separator

m1:= []int64{123,456}
A.IntJoin(m1,`|`) // 123|456

#### func IntsAppendIfNotExists

```go
func IntsAppendIfNotExists(arr []int64, ints []int64) []int64
```
Append slices if not exists

#### func ParseEmail

```go
func ParseEmail(str_emails, each_name string) []string
```
split, add alias, and concat emails with name

#### func StrAppendIfNotExists

```go
func StrAppendIfNotExists(arr []string, str string) []string
```
Append if not exists

#### func StrContains

```go
func StrContains(arr []string, str string) bool
```
Append string to array of string if not exists

#### func StrJoin

```go
func StrJoin(arr []string, sep string) string
```
combine strings in the array of string with the chosen string separator

m1:= []string{`satu`,`dua`}
A.StrJoin(m1,`-`) // satu-dua

#### func StrToInt

```go
func StrToInt(arr []string) []int64
```

Convert array of string to array of int64
func main() {

m:= []string{`1`,`2`}
L.Print(A.StrToInt(m))//output [1 2]

}

convert string list to integer list

#### func StrsAppendIfNotExists

```go
func StrsAppendIfNotExists(arr []string, strs []string) []string
```
Append slices if not exists

#### func ToJson

```go
func ToJson(arr []interface{}) string
```
convert map array of string to JSON string type

m:= []interface{}{123,`abc`}
L.Print(A.ToJson(m)) // [123,"abc"]

#### func UIntJoin

```go
func UIntJoin(arr []uint64, sep string) string
```
combine uint64s in the array of int64 with the chosen string separator

m1:= []uint64{123,456}
A.UIntJoin(m1,`-`) // 123-456

#### type MSX

```go
type MSX []map[string]interface{}
```

array (slice) of map with string key and any value

v := A.MSX{}
v = append(v, map[string]{
`foo`: 123,
`bar`: `yay`,
})

#### type X

```go
type X []interface{}
```

array (slice) of anything

v := A.X{}
v = append(v, any_value)
15 changes: 15 additions & 0 deletions B/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# B
--
import "gotro/B"


## Usage

#### func ToS

```go
func ToS(b bool) string
```
converts boolean type to string type, writing "true" or "false"

B.ToS(2 > 1) // "true"
45 changes: 45 additions & 0 deletions C/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# C
--
import "gotro/C"


## Usage

#### func IsDigit

```go
func IsDigit(ch byte) bool
```
check whether the character is a digit or not

C.IsDigit('9') // true

#### func IsIdent

```go
func IsIdent(ch byte) bool
```
check whether the character is a valid identifier suffix alphanumeric
(letter/underscore/numeral)

C.IsIdent('9'))

#### func IsIdentStart

```go
func IsIdentStart(ch byte) bool
```
check whether the character is a valid identifier prefix (letter/underscore)

C.IsIdentStart('-') // false
C.IsIdentStart('_') // true

#### func IsValidFilename

```go
func IsValidFilename(ch byte) bool
```
check whether the character is a safe file-name characters
(alphanumeric/comma/full-stop/dash)

C.IsValidFilename(' ') // output bool(true)
2 changes: 1 addition & 1 deletion D/Tt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ var TarantoolTables = map[Tt.TableName]*Tt.TableProp{
{VerifiedAt, Tt.Integer},
{LastLoginAt, Tt.Integer},
},
Unique1: Id,
AutoIncrementId: true,
Unique2: Email,
Indexes: []string{IsDeleted, SecretCode},
},
Expand Down
61 changes: 61 additions & 0 deletions F/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# F
--
import "gotro/F"


## Usage

#### func If

```go
func If(b bool, yes float64) float64
```
simplified ternary operator (bool ? val : 0), returns second argument, if the
condition (first arg) is true, returns 0 if not

F.If(true,3.12) // 3.12
F.If(false,3) // 0

#### func IfElse

```go
func IfElse(b bool, yes, no float64) float64
```
ternary operator (bool ? val1 : val2), returns second argument if the condition
(first arg) is true, third argument if not

F.IfElse(true,3.12,3.45)) // 3.12

#### func ToDateStr

```go
func ToDateStr(num float64) string
```
convert float64 unix to `YYYY-MM-DD`

#### func ToIsoDateStr

```go
func ToIsoDateStr(num float64) string
```
convert to ISO-8601 string

F.ToIsoDateStr(0) // `1970-01-01T00:00:00`

#### func ToS

```go
func ToS(num float64) string
```
convert float64 to string

F.ToS(3.1284)) // `3.1284`

#### func ToStr

```go
func ToStr(num float64) string
```
convert float64 to string with 2 digits behind the decimal point

F.ToStr(3.1284)) // `3.13`
Loading

0 comments on commit e1361c3

Please sign in to comment.