1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00
Commit Graph

1257 Commits

Author SHA1 Message Date
donutloop
0e1593c67b Slice: Add SetToDefaultIf (#187)
SetToDefaultIf sets elements to their zero value if they match the given predicate.
It retains the positions of the elements in the slice.
It returns slice of T and the count of modified slice items
2024-02-28 11:27:23 +08:00
cannian1
6c7f38d8b3 feat: more readable panic (#183) 2024-02-27 10:38:08 +08:00
donutloop
069812e0ee Hashmap: Add FilterByValue (#184)
The FilterByValue function is a method defined on the HashMap type. It generates a new HashMap
containing only the elements that satisfy a specified condition,
as determined by a predicate function applied to each element's value.

Note: Will add later doc
2024-02-27 10:36:26 +08:00
dudaodong
4a539a23c8 doc: add doc for Xnor and Nand in function package 2024-02-26 10:10:37 +08:00
dudaodong
0b1dab0399 Merge branch 'main' into v2 2024-02-26 10:02:00 +08:00
donutloop
805e2543d0 Add functional predicate NAND (#182)
Add new function, NAND, designed to create a composed predicate representing the logical NAND operation
applied to a list of predicates. The NAND operation is a logical operation
that returns true only if all perdicate result in false otherwise false
2024-02-26 09:58:19 +08:00
dudaodong
a3d518da76 remove test_src directory 2024-02-25 20:29:49 +08:00
dudaodong
e3e2d8394c Merge branch 'v2' of github.com:duke-git/lancet into v2 2024-02-25 20:25:44 +08:00
yunxuan
0eeaa06055 feat(fileutil): add CopyDir func (#180)
* add fileutil.CopyDir

* remove debug code
2024-02-25 20:25:00 +08:00
donutloop
a43bc554ee Add functional predicate XNOR (#181)
Add new function, Xnor, designed to create a composed predicate representing
the logical Exclusive NOR (XNOR) operation applied to a list of predicates.
The XNOR operation is a logical operation that returns true only
if all operands have the same boolean value
2024-02-25 20:24:47 +08:00
dudaodong
aebab7c944 refactor: break change, rename constructor of set (NewSet->New, NewSetFromSlice->FromSlice) 2024-02-25 09:32:32 +08:00
dudaodong
665bad4ca3 doc: update doc for IndexOfFunc and LastIndexOfFunc 2024-02-25 09:25:07 +08:00
donutloop
e4901e99e9 Fix optional doc links (#179) 2024-02-24 18:12:44 +08:00
donutloop
4277e8eca5 CopyOnWriteList add IndexOfFunc and LastIndexOfFunc (#178)
Allow users to apply functional predicates alongside 'index of' and 'last index of' search methods in this specialized list variant
2024-02-24 17:53:58 +08:00
donutloop
fdc93c8cc7 Change naming (#177)
Utilize terminology from the Go SDK rather than introducing novel terms to describe concepts.
2024-02-24 17:25:31 +08:00
donutloop
860a499f98 Add custom backoff setter (#176)
Users should have the capability to customize the backoff pattern and accordingly adjust it within the retry mechanism.
2024-02-23 10:04:38 +08:00
dudaodong
2e1c2276a5 test: add test coverageg 2024-02-22 14:39:53 +08:00
donutloop
d367397dab Add exponential With jitter backoff (#174)
* Add exponential With jitter backoff

Adds exponential + jitter retry policy. To enable drastic slow down of sending out requests to any external system.

Jitter in computational contexts refers to the addition of a small random variation to a value
to break the symmetric patterns

* Retry with exp: Allow shift for all multiple of 2
2024-02-22 10:39:45 +08:00
dudaodong
66fd8cf651 fix: fix go vet issue 2024-02-21 11:14:19 +08:00
dudaodong
a6be1828b9 doc: add doc and example for predicate logic of function package 2024-02-21 11:13:47 +08:00
dudaodong
8f5d297572 . 2024-02-21 11:11:52 +08:00
dudaodong
a1a4fdc598 doc: update doc for optional 2024-02-21 10:38:26 +08:00
dudaodong
1610076d22 Merge branch 'main' into v2 2024-02-21 10:21:42 +08:00
donutloop
cacbf97223 Add Retry backoff policy (#173)
The aim of this policy is to enable the configuration of various types of backoff mathematical curves. Should this modification be deemed suitable,
I will proceed to implement an exponential curve backoff policy and set of custom backoff policy
Warning: It's major break
2024-02-21 10:20:24 +08:00
donutloop
cd156dba5f Add functional nor predicate (#172) 2024-02-21 10:05:54 +08:00
dudaodong
3a71a8697d fix: fix issue #169 2024-02-20 17:29:32 +08:00
dudaodong
c88fd3db86 fix: fix go vet issue, method Unwrap() []error 2024-02-20 11:41:58 +08:00
dudaodong
27d19d1717 fix: rename Seek to SeekOffset fix go vet check issue 2024-02-20 11:39:41 +08:00
dudaodong
da24bae6b4 doc: add doc for Optional type 2024-02-20 11:22:39 +08:00
donutloop
3cd9d6b68c Add functional predicate (#171)
Enable the execution of assertion functions in a functional manner.
2024-02-20 09:55:39 +08:00
dudaodong
874d09f331 refactor: make stream struct exported 2024-02-19 15:55:08 +08:00
dudaodong
fdf251ac98 add govet check to github action file 2024-02-19 15:50:19 +08:00
dudaodong
7ec2533b7a feat: add MapToStruct 2024-02-19 13:50:06 +08:00
dudaodong
9fd0603f4a fix: fix copylocks warning in Optional struct methods 2024-02-19 10:22:28 +08:00
dudaodong
9f7b416a8d Merge branch 'main' into v2 2024-02-19 10:00:21 +08:00
donutloop
bf4b2b5fd6 Add optional (#170)
* Add optional

Wrapper container with easy to understand helper methods

* Add test and rewrite test

* Add panic test

* Add TestOrElseGetHappyPath
2024-02-19 09:59:42 +08:00
dudaodong
22af59565e fix: fix issue #168 2024-02-06 16:59:01 +08:00
dudaodong
f9e047f190 feat: add SubInBetween 2024-02-06 16:47:30 +08:00
dudaodong
fa298b740d add playground demo 2024-02-01 10:41:09 +08:00
dudaodong
6d4fc981b6 release v2.2.9 v2.2.9 2024-02-01 10:03:26 +08:00
dudaodong
4c21fe700c refactor: update StringToBytes logic 2024-01-30 10:46:55 +08:00
pigwantacat
b7370e8ef8 refactor:refactor random function (#164)
Co-authored-by: zhuhebin <zhuhebin@fengtaisec.com>
2024-01-30 10:00:14 +08:00
dudaodong
38920e3be6 fix: fix issue #162 2024-01-29 11:00:50 +08:00
dudaodong
a630a7cda9 refactor: remove struct_internal.go 2024-01-29 10:02:36 +08:00
dudaodong
66dfd9c4fd refactor: refact Comma function 2024-01-25 16:45:17 +08:00
dudaodong
be62aaac9b refactor: update signature of WriteMapsToCsv function
g
2024-01-24 11:54:42 +08:00
dudaodong
e0c9ccbce3 doc: add DeleteRange 2024-01-23 17:27:28 +08:00
dudaodong
d2d1e5a055 feat: refact DeleteAt and add DeleteRange function 2024-01-22 15:34:35 +08:00
dudaodong
bbc58c7e46 fix: fix the map key order issue of WriteMapsToCsv 2024-01-22 11:10:02 +08:00
dudaodong
ac2ecceaec refactor: refact reduce function 2024-01-03 10:46:28 +08:00