Lancet Documentation

website·Indexed 29 days ago

https://uvdream.github.io/lancet-docs/

A Go library providing a comprehensive set of data structures and utility packages. It includes implementations of common data structures like HashMap, Heap, Queue, Stack, and Tree, as well as utility packages for slice manipulation, string and map utilities, concurrency, cryptography, file operations, and mathematical calculations.

Tokens
46K
Snippets
493
Records
504
Agent score
72%

What's inside Lancet

  1. Overview of the Lancet Go utility library

    Lancet is a comprehensive, efficient, and reusable Go utility library providing over 300 commonly used tool functions. It supports multiple domains including strings, slices, datetime, networking, and cryptography. Key characteristics include:

    • Zero External Dependencies: The library relies exclusively on the Go standard library.
    • High Reliability: All exported functions have 100% unit test coverage.
  2. Overview of Lancet Cryptor package

    The cryptor package provides support for data encryption and decryption, as well as generating MD5 and hash values. It supports several standards including Base64, MD5, HMAC, AES, DES, and RSA.
    import (
        "github.com/duke-git/lancet/v2/cryptor"
    )
  3. Overview of Lancet List data structure

    The List is a linear list data structure implemented using Go slices. It provides a generic wrapper around slices to offer common list operations such as insertion, deletion, searching, and merging.
    import (
        "github.com/duke-git/lancet/v2/datastructure/list"
    )
  4. Overview of the Lancet Go utility library

    Lancet is a comprehensive, efficient, and reusable Go utility library providing over 300 utility functions. It supports a wide range of operations including string manipulation, slice handling, datetime processing, networking, and cryptography. The library is designed to depend only on the Go standard library and ensures reliability by providing unit tests for every exported function.
  5. Overview of Lancet Set data structure

    The Set data structure in Lancet is similar to a list but ensures that all elements are unique. It is implemented as a map with boolean values for efficient lookups and modifications.
    import (
        set "github.com/duke-git/lancet/v2/datastructure/set"
    )
  6. Overview of Lancet Set data structure

    The Set is a data container similar to a list, but it ensures that all elements are unique (no duplicates). It is implemented as a map with boolean values and supports any comparable type T via Go generics.
    import (
        set "github.com/duke-git/lancet/v2/datastructure/set"
    )
  7. Create and manage a SinglyLink (Single Linked List)

    SinglyLink is a unidirectional linked list where each node contains a value and a pointer to the next node. It provides methods for insertion, deletion, and utility operations like reversing the list or finding the middle node.
  8. Determine OS architecture bits

    Use system.GetOsBits() to determine if the current operating system is 32-bit or 64-bit. The function returns an integer (32 or 64).
    import (
        "fmt"
        "github.com/duke-git/lancet/v2/system"
    )
    
    func main() {
        bits := system.GetOsBits()
        fmt.Printf("Current OS is %d-bit\n", bits)
    }
  9. Get the operating system architecture bits

    Use GetOsBits() to determine if the current operating system is 32-bit or 64-bit. The function returns an integer (32 or 64).
    import (
    	"fmt"
    	"github.com/duke-git/lancet/v2/system"
    )
    
    func main() {
    	osBit := system.GetOsBits()
    	fmt.Printf("OS Architecture: %d-bit\n", osBit)
    }
  10. Retrieve public IP information

    Use GetPublicIpInfo to fetch detailed information about the current public IP address, including country, region, city, ISP, and coordinates. It returns a PublicIpInfo struct.
    package main
    
    import (
        "fmt"
        "github.com/duke-git/lancet/v2/netutil"
    )
    
    func main() {
    	publicIpInfo, err := netutil.GetPublicIpInfo()
    	if err != nil {
    		fmt.Println(err)
    	}
    
    	fmt.Println(publicIpInfo)
    }