Lancet Utility Library for Go

repository·main·Indexed 26 days ago

https://github.com/duke-git/lancet

A comprehensive and reusable utility function library for Go, inspired by Apache Commons and Lodash. Lancet v2 utilizes Go generics for Go 1.18+ and provides over 700 functions across specialized sub-packages, including strutil for strings, compare for type-agnostic comparisons, concurrency for goroutines and keyed locking, condition for logical operations, convertor for data type transformations, cryptor for encryption (AES, DES, RSA, SM2/3/4), and datetime for time formatting and arithmetic.

Tokens
101.4K
Snippets
552
Records
1K
Agent score
89%

What's inside Lancet

  1. Overview of cryptor capabilities

    main

    The cryptor package provides a comprehensive suite of data encryption and decryption utilities. Supported algorithms and formats include:

    • Encoding: Base64
    • Hashing: MD5, SHA1, SHA256, SHA512, SM3
    • HMAC: MD5, SHA1, SHA256, SHA512
    • Symmetric Encryption:
      • AES (ECB, CBC, CTR, CFB, OFB, GCM modes)
      • DES (ECB, CBC, CFB, OFB modes)
      • SM4 (ECB, CBC modes)
    • Asymmetric Encryption:
      • RSA (Standard, OAEP, Signing, and Verification)
      • SM2
  2. Overview of Linklist data structures

    main

    The link package provides implementations of linked lists where each node contains a value and a pointer to the next node. It supports two primary types:

    1. SinglyLink: A singly linked list.
    2. DoublyLink: A doubly linked list.

    Both types support common operations such as insertion, deletion, reversing, and size retrieval.

  3. Overview of the lancet Go utility library

    main
    lancet (柳叶刀) is a powerful, comprehensive, efficient, and reusable utility library for the Go programming language. Inspired by Java's apache common package and lodash.js, it is designed to simplify common development tasks by providing high-level abstractions for complex operations.
  4. Overview of Lancet

    main

    Lancet is a powerful utility function library for Go. It provides over 600 utility functions across various domains including string, slice, datetime, net, crypto, and concurrency.

    Key characteristics:

    • Modular by design: Each module is a standalone package with no coupling between modules.
    • Pure: The library only depends on the Go standard library and golang.org/x packages.
    • Simple: Well-structured with tests for every exported function.
  5. Overview of Lancet functional modules

    main
    Lancet is a comprehensive and efficient Go utility library containing over 600 tool functions across 25 packages. It provides utilities for a wide range of common programming tasks including string manipulation, slice processing, networking, concurrency, cryptography, file handling, time/date management, stream processing, and iterators.
  6. Overview of Lancet utility library

    main

    Lancet is a powerful, efficient, and reusable utility function library for Go, inspired by Java's Apache Commons and JavaScript's Lodash.js. It is designed to simplify Go development by providing high-level abstractions for common tasks.

    Key areas of utility include:

    • Collections: Iterating over slices and arrays.
    • Strings: Advanced string manipulation.
    • Networking: Working with net and http packages.
    • General Utilities: Tools for random, crypto, stream, retry, math, and more.
  7. Overview of Lancet features

    main

    Lancet is a powerful Go utility library designed to be concise, powerful, and efficient. Key features include:

    • Comprehensive Functionality: Supports over 600 Go utility functions covering strings, slices, date/time, networking, cryptography, concurrency, and more.
    • Modular Design: Each module is designed as a separate package, ensuring zero coupling between modules.
    • Pure Dependencies: The library only depends on the Go standard library and golang.org/x packages.
    • Clean and Tested: Well-structured code with tests for every exported function.
  8. Overview of Lancet function modules

    main
    Lancet is a comprehensive Go language utility library containing 25 packages and over 600 utility functions. It provides tools for various common programming tasks including string and slice processing, networking, concurrency, encryption/decryption, file processing, time/date manipulation, stream processing, and iterators.
  9. Overview of datetime package functions

    main

    The datetime package provides utilities for formatting, comparing, and manipulating dates and times. Available operations include:

    • Time Arithmetic: Adding days, weeks, months, years, hours, and minutes (AddDay, AddWeek, AddMonth, AddYear, AddHour, AddMinute).
    • Safe Arithmetic: Safe versions of addition for days, months, and years (AddDaySafe, AddMonthSafe, AddYearSafe).
    • Boundary Calculation: Finding the start or end of minutes, hours, days, weeks, months, or years (BeginOf..., EndOf...).
    • Current Time Retrieval: Getting current date, time, or full datetime (GetNowDate, GetNowTime, GetNowDateTime).
    • Formatting & Parsing: Converting between strings and time objects (FormatTimeToStr, FormatStrToTime, ToFormat, ToIso8601).
    • Unix Timestamps: Creating new time objects from Unix timestamps or converting to various timestamp precisions (NewUnix, ToUnix, TimestampMilli, TimestampMicro, TimestampNano).
    • Comparisons & Intervals: Calculating differences between dates (DaysBetween, BetweenSeconds) and generating ranges (GenerateDatetimesBetween).
  10. Overview of Queue implementations

    main

    The queue package provides several types of linear table implementations. A queue allows deletions at the front and insertions at the rear. Available implementations include:

    • ArrayQueue: An array-based queue.
    • LinkedQueue: A linked-list-based queue.
    • CircularQueue: A circular buffer-based queue.
    • PriorityQueue: A queue where elements are processed based on priority.
  11. Map manipulation utilities in maputil

    main

    The maputil package provides a comprehensive suite of utilities for working with Go maps, including filtering, merging, transforming, and converting between maps, slices, and structs. Key capabilities include:

    • Filtering & Omission: Filter, FilterByKeys, FilterByValues, OmitBy, OmitByKeys, and OmitByValues.
    • Transformation: MapKeys, MapValues, Transform, Entries, FromEntries, and MapToStruct.
    • Set Operations: Intersect (intersection of multiple maps), Minus (difference between maps), and IsDisjoint (check if maps share no keys).
    • Extraction: Keys, KeysBy, Values, and ValuesBy to extract keys or values into slices.
    • Merging: Merge to combine multiple maps (later keys overwrite earlier ones).
    • Iteration & Access: ForEach, HasKey, GetOrSet, and ToSortedSlicesDefault / ToSortedSlicesWithComparator for sorted output.