Skip to content
Snippets Groups Projects
Select Git revision
  • feature/v1.3.60
  • develop default protected
  • main protected
  • release/v1.0.7
  • release/v1.0.0
  • feature/v0.9.5
  • release/v0.6.2
  • hotfix/v0.5.7
  • release/v0.5.6
  • release/v0.5.5
  • hotfix/v0.5.4
  • hotfix/v0.5.3
  • hotfix/v0.5.2
  • release/v0.5.1
  • hotfix/v0.5.0
  • hotfix/v0.4.9
  • hotfix/v0.4.8
  • hotfix/v0.4.7
  • release/v0.4.6
  • hotfix/v0.4.5
  • v1.3.55
  • v1.3.52
  • v1.3.50
  • v1.3.45
  • v1.3.42
  • v1.3.41
  • v1.3.40
  • v1.3.38
  • v1.3.37
  • v1.3.36
  • v1.3.35
  • v1.3.34
  • v1.3.33
  • v1.3.32
  • v1.3.31
  • v1.3.30
  • v1.3.29
  • v1.3.28
  • v1.3.27
  • v1.3.26
40 results

core

  • Clone with SSH
  • Clone with HTTPS
  • Md. Alim Ul Karim's avatar
    Alim Ul Karim authored
    v0.8.6
    d148f268
    History

    Core Intro

    Use Package logo

    All common core infrastructure and constants combined package.

    Git Clone

    git clone https://gitlab.com/evatix-go/core.git

    2FA enabled, for linux

    git clone https://[YourGitLabUserName]:[YourGitlabAcessTokenGenerateFromGitlabsTokens]@gitlab.com/evatix-go/core.git

    Prerequisites

    • Update git to latest 2.29
    • Update or install the latest of Go 1.15.2
    • Either add your ssh key to your gitlab account
    • Or, use your access token to clone it.

    Installation

    go get gitlab.com/evatix-go/core

    Go get issue for private package

    • Update git to 2.29
    • Enable go modules. (Windows : go env -w GO111MODULE=on, Unix : export GO111MODULE=on)
    • Add gitlab.com/evatix-go to go env private

    To set for Windows:

    go env -w GOPRIVATE=[AddExistingOnes;]gitlab.com/evatix-go

    To set for Unix:

    expoort GOPRIVATE=[AddExistingOnes;]gitlab.com/evatix-go

    Why core?

    It makes our other go-packages DRY and concise.

    Examples Videos

    Examples

    // substituting functions as ternary operator
    fmt.Println(conditional.Int(true, 2, 7)) // 2
    fmt.Println(conditional.Int(false, 2, 7)) // 7
    
    // making collection from array of strings
    stringValues := []string{"hello", "world", "something"}
    collectionPtr1 := corestr.NewCollectionPtrUsingStrings(&stringValues, constants.Zero)
    fmt.Println(collectionPtr1)
    /* outputs:
       - hello
       - world
       - something
    */
    
    // different methods of collection
    fmt.Println(collectionPtr1.Length()) // 3
    fmt.Println(collectionPtr1.IsEmpty()) // false
    
    // adding more element including empty string
    collectionPtr2 := collectionPtr1.AddsLock("else")
    fmt.Println(collectionPtr2.Length()) // 4
    
    // checking equality
    fmt.Println(collectionPtr1.IsEqualsPtr(collectionPtr2)) // true
    
    // creating CharCollectionMap using collection
    sampleMap := collectionPtr1.CharCollectionPtrMap()
    fmt.Println(sampleMap)
    
    // methods on CharCollectionMap
    fmt.Println(sampleMap.Length()) // 4
    fmt.Println(sampleMap.AllLengthsSum()) // 4
    fmt.Println(sampleMap.Clear()) // prints: # Summary of `*corestr.CharCollectionMap`, Length ("0") - Sequence `1`
    otherMap := sampleMap.Add("another")
    fmt.Println(otherMap)
    /* prints:
       # Summary of `*corestr.CharCollectionMap`, Length ("1") - Sequence `1`
             1 . `a` has `1` items.
       ## Items of `a`
             - another
    */
    
    // declaring an empty hashset of length 2 and calling methods on it
    newHashSet := corestr.NewHashset(2)
    fmt.Println(newHashSet.Length()) // 2
    fmt.Println(newHashSet.IsEmpty()) // true
    fmt.Println(newHashSet.Items()) // &map[]
    
    // adding items to hashset
    strPtr := "new"
    newHashSet.AddPtr(&strPtr)
    fmt.Println(newHashSet.Items()) // &map[new:true]
    
    // adding map to hashset
    newHashSet.AddItemsMap(&map[string]bool{"hi": true, "no": false})
    fmt.Println(newHashSet.Items()) // &map[hi:true new:true]
    
    // math operations: getting the larger/smaller value from two given values
    fmt.Println(coremath.MaxByte('e', 'i')) // 105 which represents 'i' in ASCII
    fmt.Println(coremath.MinByte(23, 5))    // 5
    
    // initializing issetter value
    isSetterValue := issetter.False // initializing as false
    fmt.Println(isSetterValue.HasInitialized()) // true
    fmt.Println(isSetterValue.Value()) // 2
    fmt.Println(isSetterValue.IsPositive()) // false
    
    // sorting strings
    fruits := []string{"banana", "mango", "apple"}
    fmt.Println(strsort.Quick(&fruits)) // &[apple banana mango]
    fmt.Println(strsort.QuickDsc(&fruits)) // &[mango banana apple]
    
    // converting pointer strings to strings
    mile := "mile"
    km := "km"
    measures := []*string{&mile, &km}
    fmt.Println(converters.PointerStringsToStrings(&measures)) // &[mile km]
    fmt.Printf("Type %T", converters.PointerStringsToStrings(&measures)) // Type *[]string
    
    // comparing two int arays
    Values := []int{1, 2, 3, 4}
    OtherValues := []int{5, 6, 7, 8}
    fmt.Println(corecompare.IntArray(Values, OtherValues)) // false

    Acknowledgement

    Any other packages used

    Links

    Issues

    Notes

    Contributors

    License

    Evatix MIT License