mirror of
https://github.com/duke-git/lancet.git
synced 2025-09-26 19:41:20 +08:00
doc: add go playground demo
This commit is contained in:
45
README.md
45
README.md
@@ -397,6 +397,9 @@ import "github.com/duke-git/lancet/v2/cryptor"
|
|||||||
- **<big>HmacSha512</big>** : return the hmac hash of string use sha512.
|
- **<big>HmacSha512</big>** : return the hmac hash of string use sha512.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha512)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#HmacSha512)]
|
||||||
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
|
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
|
||||||
|
- **<big>Md5Byte</big>** : return the md5 string of byte slice.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5Byte)]
|
||||||
|
[[play](https://go.dev/play/p/suraalH8lyC)]
|
||||||
- **<big>Md5String</big>** : return the md5 value of string.
|
- **<big>Md5String</big>** : return the md5 value of string.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5String)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor.md#Md5String)]
|
||||||
[[play](https://go.dev/play/p/1bLcVetbTOI)]
|
[[play](https://go.dev/play/p/1bLcVetbTOI)]
|
||||||
@@ -486,6 +489,12 @@ import "github.com/duke-git/lancet/v2/datetime"
|
|||||||
- **<big>GetNowDateTime</big>** : return format yyyy-mm-dd hh-mm-ss of current datetime.
|
- **<big>GetNowDateTime</big>** : return format yyyy-mm-dd hh-mm-ss of current datetime.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#GetNowDateTime)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#GetNowDateTime)]
|
||||||
[[play](https://go.dev/play/p/pI4AqngD0al)]
|
[[play](https://go.dev/play/p/pI4AqngD0al)]
|
||||||
|
- **<big>GetTodayStartTime</big>** : return the start time of today, format: yyyy-mm-dd 00:00:00.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#GetTodayStartTime)]
|
||||||
|
[[play](https://go.dev/play/p/84siyYF7t99)]
|
||||||
|
- **<big>GetTodayEndTime</big>** : return the end time of today, format: yyyy-mm-dd 23:59:59.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#GetTodayEndTime)]
|
||||||
|
[[play](https://go.dev/play/p/jjrLnfoqgn3)]
|
||||||
- **<big>GetZeroHourTimestamp</big>** : return timestamp of zero hour (timestamp of 00:00).
|
- **<big>GetZeroHourTimestamp</big>** : return timestamp of zero hour (timestamp of 00:00).
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#GetZeroHourTimestamp)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#GetZeroHourTimestamp)]
|
||||||
[[play](https://go.dev/play/p/QmL2oIaGE3q)]
|
[[play](https://go.dev/play/p/QmL2oIaGE3q)]
|
||||||
@@ -1517,76 +1526,112 @@ import "github.com/duke-git/lancet/v2/tuple"
|
|||||||
|
|
||||||
- **<big>Tuple2</big>** : represents a 2 elemnets tuple.
|
- **<big>Tuple2</big>** : represents a 2 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple2)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple2)]
|
||||||
|
[[play](https://go.dev/play/p/3sHVqBQpLYN)]
|
||||||
- **<big>Tuple2_Unbox</big>** : returns values in Tuple2.
|
- **<big>Tuple2_Unbox</big>** : returns values in Tuple2.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple2_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple2_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/0fD1qfCVwjm)]
|
||||||
- **<big>Zip2</big>** : create a slice of Tuple2, whose elements are correspond to the given slice elements.
|
- **<big>Zip2</big>** : create a slice of Tuple2, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip2)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip2)]
|
||||||
|
[[play](https://go.dev/play/p/4ncWJJ77Xio)]
|
||||||
- **<big>Unzip2</big>** : create a group of slice from a slice of Tuple2.
|
- **<big>Unzip2</big>** : create a group of slice from a slice of Tuple2.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip2)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip2)]
|
||||||
|
[[play](https://go.dev/play/p/KBecr60feXb)]
|
||||||
- **<big>Tuple3</big>** : represents a 3 elemnets tuple.
|
- **<big>Tuple3</big>** : represents a 3 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple3)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple3)]
|
||||||
|
[[play](https://go.dev/play/p/FtH2sdCLlCf)]
|
||||||
- **<big>Tuple3_Unbox</big>** : returns values in Tuple3.
|
- **<big>Tuple3_Unbox</big>** : returns values in Tuple3.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple3_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple3_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/YojLy-id1BS)]
|
||||||
- **<big>Zip3</big>** : create a slice of Tuple3, whose elements are correspond to the given slice elements.
|
- **<big>Zip3</big>** : create a slice of Tuple3, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip3)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip3)]
|
||||||
|
[[play](https://go.dev/play/p/97NgmsTILfu)]
|
||||||
- **<big>Unzip3</big>** : create a group of slice from a slice of Tuple3.
|
- **<big>Unzip3</big>** : create a group of slice from a slice of Tuple3.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip3)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip3)]
|
||||||
|
[[play](https://go.dev/play/p/bba4cpAa7KO)]
|
||||||
- **<big>Tuple4</big>** : represents a 4 elemnets tuple.
|
- **<big>Tuple4</big>** : represents a 4 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple4)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple4)]
|
||||||
|
[[play](https://go.dev/play/p/D2EqDz096tk)]
|
||||||
- **<big>Tuple4_Unbox</big>** : returns values in Tuple4.
|
- **<big>Tuple4_Unbox</big>** : returns values in Tuple4.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple4_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple4_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/ACj9YuACGgW)]
|
||||||
- **<big>Zip4</big>** : create a slice of Tuple4, whose elements are correspond to the given slice elements.
|
- **<big>Zip4</big>** : create a slice of Tuple4, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip4)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip4)]
|
||||||
|
[[play](https://go.dev/play/p/PEmTYVK5hL4)]
|
||||||
- **<big>Unzip4</big>** : create a group of slice from a slice of Tuple4.
|
- **<big>Unzip4</big>** : create a group of slice from a slice of Tuple4.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip4)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip4)]
|
||||||
|
[[play](https://go.dev/play/p/rb8z4gyYSRN)]
|
||||||
- **<big>Tuple5</big>** : represents a 5 elemnets tuple.
|
- **<big>Tuple5</big>** : represents a 5 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple5)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple5)]
|
||||||
|
[[play](https://go.dev/play/p/2WndmVxPg-r)]
|
||||||
- **<big>Tuple5_Unbox</big>** : returns values in Tuple4.
|
- **<big>Tuple5_Unbox</big>** : returns values in Tuple4.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple5_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple5_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/GyIyZHjCvoS)]
|
||||||
- **<big>Zip5</big>** : create a slice of Tuple5, whose elements are correspond to the given slice elements.
|
- **<big>Zip5</big>** : create a slice of Tuple5, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip5)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip5)]
|
||||||
|
[[play](https://go.dev/play/p/fCAAJLMfBIP)]
|
||||||
- **<big>Unzip5</big>** : create a group of slice from a slice of Tuple5.
|
- **<big>Unzip5</big>** : create a group of slice from a slice of Tuple5.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip5)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip5)]
|
||||||
|
[[play](https://go.dev/play/p/gyl6vKfhqPb)]
|
||||||
- **<big>Tuple6</big>** : represents a 6 elemnets tuple.
|
- **<big>Tuple6</big>** : represents a 6 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple6)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple6)]
|
||||||
|
[[play](https://go.dev/play/p/VjqcCwEJZbs)]
|
||||||
- **<big>Tuple6_Unbox</big>** : returns values in Tuple6.
|
- **<big>Tuple6_Unbox</big>** : returns values in Tuple6.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple6_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple6_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/FjIHV7lpxmW)]
|
||||||
- **<big>Zip6</big>** : create a slice of Tuple6, whose elements are correspond to the given slice elements.
|
- **<big>Zip6</big>** : create a slice of Tuple6, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip6)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip6)]
|
||||||
|
[[play](https://go.dev/play/p/oWPrnUYuFHo)]
|
||||||
- **<big>Unzip6</big>** : create a group of slice from a slice of Tuple6.
|
- **<big>Unzip6</big>** : create a group of slice from a slice of Tuple6.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip6)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip6)]
|
||||||
|
[[play](https://go.dev/play/p/l41XFqCyh5E)]
|
||||||
- **<big>Tuple7</big>** : represents a 7 elemnets tuple.
|
- **<big>Tuple7</big>** : represents a 7 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple7)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple7)]
|
||||||
|
[[play](https://go.dev/play/p/dzAgv_Ezub9)]
|
||||||
- **<big>Tuple7_Unbox</big>** : returns values in Tuple7.
|
- **<big>Tuple7_Unbox</big>** : returns values in Tuple7.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple7_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple7_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/R9I8qeDk0zs)]
|
||||||
- **<big>Zip7</big>** : create a slice of Tuple7, whose elements are correspond to the given slice elements.
|
- **<big>Zip7</big>** : create a slice of Tuple7, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip7)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip7)]
|
||||||
|
[[play](https://go.dev/play/p/WUJuo897Egf)]
|
||||||
- **<big>Unzip7</big>** : create a group of slice from a slice of Tuple7.
|
- **<big>Unzip7</big>** : create a group of slice from a slice of Tuple7.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip7)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip7)]
|
||||||
|
[[play](https://go.dev/play/p/hws_P1Fr2j3)]
|
||||||
- **<big>Tuple8</big>** : represents a 8 elemnets tuple.
|
- **<big>Tuple8</big>** : represents a 8 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple8)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple8)]
|
||||||
|
[[play](https://go.dev/play/p/YA9S0rz3dRz)]
|
||||||
- **<big>Tuple8_Unbox</big>** : returns values in Tuple8.
|
- **<big>Tuple8_Unbox</big>** : returns values in Tuple8.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple8_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple8_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/PRxLBBb4SMl)]
|
||||||
- **<big>Zip8</big>** : create a slice of Tuple8, whose elements are correspond to the given slice elements.
|
- **<big>Zip8</big>** : create a slice of Tuple8, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip8)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip8)]
|
||||||
|
[[play](https://go.dev/play/p/8V9jWkuJfaQ)]
|
||||||
- **<big>Unzip8</big>** : create a group of slice from a slice of Tuple8.
|
- **<big>Unzip8</big>** : create a group of slice from a slice of Tuple8.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip8)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip8)]
|
||||||
|
[[play](https://go.dev/play/p/1SndOwGsZB4)]
|
||||||
- **<big>Tuple9</big>** : represents a 9 elemnets tuple.
|
- **<big>Tuple9</big>** : represents a 9 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple9)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple9)]
|
||||||
|
[[play](https://go.dev/play/p/yS2NGGtZpQr)]
|
||||||
- **<big>Tuple9_Unbox</big>** : returns values in Tuple9.
|
- **<big>Tuple9_Unbox</big>** : returns values in Tuple9.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple9_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple9_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/oFJFGTAuOa8)]
|
||||||
- **<big>Zip9</big>** : create a slice of Tuple9, whose elements are correspond to the given slice elements.
|
- **<big>Zip9</big>** : create a slice of Tuple9, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip9)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip9)]
|
||||||
|
[[play](https://go.dev/play/p/cgsL15QYnfz)]
|
||||||
- **<big>Unzip9</big>** : create a group of slice from a slice of Tuple9.
|
- **<big>Unzip9</big>** : create a group of slice from a slice of Tuple9.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip9)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip9)]
|
||||||
|
[[play](https://go.dev/play/p/91-BU_KURSA)]
|
||||||
- **<big>Tuple10</big>** : represents a 10 elemnets tuple.
|
- **<big>Tuple10</big>** : represents a 10 elemnets tuple.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple10)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple10)]
|
||||||
|
[[play](https://go.dev/play/p/799qqZg0hUv)]
|
||||||
- **<big>Tuple10_Unbox</big>** : returns values in Tuple10.
|
- **<big>Tuple10_Unbox</big>** : returns values in Tuple10.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple10_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Tuple10_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/qfyx3x_X0Cu)]
|
||||||
- **<big>Zip10</big>** : create a slice of Tuple10, whose elements are correspond to the given slice elements.
|
- **<big>Zip10</big>** : create a slice of Tuple10, whose elements are correspond to the given slice elements.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip10)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Zip10)]
|
||||||
|
[[play](https://go.dev/play/p/YSR-2cXnrY4)]
|
||||||
- **<big>Unzip10</big>** : create a group of slice from a slice of Tuple10.
|
- **<big>Unzip10</big>** : create a group of slice from a slice of Tuple10.
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip10)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple.md#Unzip10)]
|
||||||
|
[[play](https://go.dev/play/p/-taQB6Wfre_z)]
|
||||||
|
|
||||||
<h3 id="Validator"> 24. Validator package contains some functions for data validation. <a href="#index">index</a></h3>
|
<h3 id="Validator"> 24. Validator package contains some functions for data validation. <a href="#index">index</a></h3>
|
||||||
|
|
||||||
|
@@ -396,6 +396,9 @@ import "github.com/duke-git/lancet/v2/cryptor"
|
|||||||
- **<big>HmacSha512</big>** : 返回字符串 sha256 hmac 值。
|
- **<big>HmacSha512</big>** : 返回字符串 sha256 hmac 值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha512)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#HmacSha512)]
|
||||||
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
|
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
|
||||||
|
- **<big>Md5Byte</big>** : 返回byte slice的md5值.
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5Byte)]
|
||||||
|
[[play](https://go.dev/play/p/suraalH8lyC)]
|
||||||
- **<big>Md5String</big>** : 返回字符串 md5 值。
|
- **<big>Md5String</big>** : 返回字符串 md5 值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5String)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/cryptor_zh-CN.md#Md5String)]
|
||||||
[[play](https://go.dev/play/p/1bLcVetbTOI)]
|
[[play](https://go.dev/play/p/1bLcVetbTOI)]
|
||||||
@@ -485,6 +488,12 @@ import "github.com/duke-git/lancet/v2/datetime"
|
|||||||
- **<big>GetNowDateTime</big>** : 获取当时日期和时间,返回格式:yyyy-mm-dd hh:mm:ss。
|
- **<big>GetNowDateTime</big>** : 获取当时日期和时间,返回格式:yyyy-mm-dd hh:mm:ss。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#GetNowDateTime)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#GetNowDateTime)]
|
||||||
[[play](https://go.dev/play/p/pI4AqngD0al)]
|
[[play](https://go.dev/play/p/pI4AqngD0al)]
|
||||||
|
- **<big>GetTodayStartTime</big>** : 返回当天开始时间, 格式: yyyy-mm-dd 00:00:00。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#GetTodayStartTime)]
|
||||||
|
[[play](https://go.dev/play/p/84siyYF7t99)]
|
||||||
|
- **<big>GetTodayEndTime</big>** : 返回当天结束时间,格式: yyyy-mm-dd 23:59:59。
|
||||||
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#GetTodayEndTime)]
|
||||||
|
[[play](https://go.dev/play/p/jjrLnfoqgn3)]
|
||||||
- **<big>GetZeroHourTimestamp</big>** : 获取零时时间戳(timestamp of 00:00)。
|
- **<big>GetZeroHourTimestamp</big>** : 获取零时时间戳(timestamp of 00:00)。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#GetZeroHourTimestamp)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#GetZeroHourTimestamp)]
|
||||||
[[play](https://go.dev/play/p/QmL2oIaGE3q)]
|
[[play](https://go.dev/play/p/QmL2oIaGE3q)]
|
||||||
@@ -1522,76 +1531,113 @@ import "github.com/duke-git/lancet/v2/tuple"
|
|||||||
|
|
||||||
- **<big>Tuple2</big>** : 2 元元组
|
- **<big>Tuple2</big>** : 2 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple2)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple2)]
|
||||||
|
[[play](https://go.dev/play/p/3sHVqBQpLYN)]
|
||||||
- **<big>Tuple2_Unbox</big>** : 返回 2 元元组的字段值。
|
- **<big>Tuple2_Unbox</big>** : 返回 2 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple2_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple2_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/0fD1qfCVwjm)]
|
||||||
- **<big>Zip2</big>** : 创建一个 Tuple2 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip2</big>** : 创建一个 Tuple2 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip2)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip2)]
|
||||||
|
[[play](https://go.dev/play/p/4ncWJJ77Xio)]
|
||||||
- **<big>Unzip2</big>** : 根据传入的Tuple2切片,创建一组和Tuple2元素相对应的切片。
|
- **<big>Unzip2</big>** : 根据传入的Tuple2切片,创建一组和Tuple2元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip2)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip2)]
|
||||||
|
[[play](https://go.dev/play/p/KBecr60feXb)]
|
||||||
- **<big>Tuple3</big>** : 3 元元组
|
- **<big>Tuple3</big>** : 3 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple3)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple3)]
|
||||||
|
[[play](https://go.dev/play/p/FtH2sdCLlCf)]
|
||||||
- **<big>Tuple3_Unbox</big>** : 返回 3 元元组的字段值。
|
- **<big>Tuple3_Unbox</big>** : 返回 3 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple3_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple3_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/YojLy-id1BS)]
|
||||||
- **<big>Zip3</big>** : 创建一个 Tuple3 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip3</big>** : 创建一个 Tuple3 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip3)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip3)]
|
||||||
|
[[play](https://go.dev/play/p/97NgmsTILfu)]
|
||||||
- **<big>Unzip3</big>** : 根据传入的Tuple3切片,创建一组和Tuple3元素相对应的切片。
|
- **<big>Unzip3</big>** : 根据传入的Tuple3切片,创建一组和Tuple3元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip3)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip3)]
|
||||||
|
[[play](https://go.dev/play/p/bba4cpAa7KO)]
|
||||||
- **<big>Tuple4</big>** : 4 元元组
|
- **<big>Tuple4</big>** : 4 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple4)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple4)]
|
||||||
|
[[play](https://go.dev/play/p/D2EqDz096tk)]
|
||||||
- **<big>Tuple4_Unbox</big>** : 返回 4 元元组的字段值。
|
- **<big>Tuple4_Unbox</big>** : 返回 4 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple4_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple4_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/ACj9YuACGgW)]
|
||||||
- **<big>Zip4</big>** : 创建一个 Tuple4 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip4</big>** : 创建一个 Tuple4 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip4)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip4)]
|
||||||
|
[[play](https://go.dev/play/p/PEmTYVK5hL4)]
|
||||||
- **<big>Unzip4</big>** : 根据传入的Tuple4切片,创建一组和Tuple4元素相对应的切片。
|
- **<big>Unzip4</big>** : 根据传入的Tuple4切片,创建一组和Tuple4元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip4)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip4)]
|
||||||
|
[[play](https://go.dev/play/p/rb8z4gyYSRN)]
|
||||||
- **<big>Tuple5</big>** : 5 元元组
|
- **<big>Tuple5</big>** : 5 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple5)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple5)]
|
||||||
|
[[play](https://go.dev/play/p/2WndmVxPg-r)]
|
||||||
- **<big>Tuple5_Unbox</big>** : 返回 5 元元组的字段值。
|
- **<big>Tuple5_Unbox</big>** : 返回 5 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple5_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple5_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/GyIyZHjCvoS)]
|
||||||
- **<big>Zip5</big>** : 创建一个 Tuple5 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip5</big>** : 创建一个 Tuple5 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip5)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip5)]
|
||||||
|
[[play](https://go.dev/play/p/fCAAJLMfBIP)]
|
||||||
- **<big>Unzip5</big>** : 根据传入的Tuple5切片,创建一组和Tuple5元素相对应的切片。
|
- **<big>Unzip5</big>** : 根据传入的Tuple5切片,创建一组和Tuple5元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip5)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip5)]
|
||||||
|
[[play](https://go.dev/play/p/gyl6vKfhqPb)]
|
||||||
- **<big>Tuple6</big>** : 6 元元组
|
- **<big>Tuple6</big>** : 6 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple6)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple6)]
|
||||||
|
[[play](https://go.dev/play/p/VjqcCwEJZbs)]
|
||||||
- **<big>Tuple6_Unbox</big>** : 返回 6 元元组的字段值。
|
- **<big>Tuple6_Unbox</big>** : 返回 6 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple6_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple6_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/FjIHV7lpxmW)]
|
||||||
- **<big>Zip6</big>** : 创建一个 Tuple6 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip6</big>** : 创建一个 Tuple6 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip6)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip6)]
|
||||||
|
[[play](https://go.dev/play/p/oWPrnUYuFHo)]
|
||||||
- **<big>Unzip6</big>** : 根据传入的Tuple6切片,创建一组和Tuple6元素相对应的切片。
|
- **<big>Unzip6</big>** : 根据传入的Tuple6切片,创建一组和Tuple6元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip6)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip6)]
|
||||||
|
[[play](https://go.dev/play/p/l41XFqCyh5E)]
|
||||||
- **<big>Tuple7</big>** : 7 元元组
|
- **<big>Tuple7</big>** : 7 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple7)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple7)]
|
||||||
|
[[play](https://go.dev/play/p/dzAgv_Ezub9)]
|
||||||
- **<big>Tuple7_Unbox</big>** : 返回 7 元元组的字段值。
|
- **<big>Tuple7_Unbox</big>** : 返回 7 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple7_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple7_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/R9I8qeDk0zs)]
|
||||||
- **<big>Zip7</big>** : 创建一个 Tuple7 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip7</big>** : 创建一个 Tuple7 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip7)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip7)]
|
||||||
|
[[play](https://go.dev/play/p/WUJuo897Egf)]
|
||||||
- **<big>Unzip7</big>** : 根据传入的Tuple7切片,创建一组和Tuple7元素相对应的切片。
|
- **<big>Unzip7</big>** : 根据传入的Tuple7切片,创建一组和Tuple7元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip7)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip7)]
|
||||||
|
[[play](https://go.dev/play/p/hws_P1Fr2j3)]
|
||||||
- **<big>Tuple8</big>** : 8 元元组
|
- **<big>Tuple8</big>** : 8 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple8)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple8)]
|
||||||
|
[[play](https://go.dev/play/p/YA9S0rz3dRz)]
|
||||||
- **<big>Tuple8_Unbox</big>** : 返回 8 元元组的字段值。
|
- **<big>Tuple8_Unbox</big>** : 返回 8 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple8_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple8_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/PRxLBBb4SMl)]
|
||||||
- **<big>Zip8</big>** : 创建一个 Tuple8 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip8</big>** : 创建一个 Tuple8 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip8)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip8)]
|
||||||
|
[[play](https://go.dev/play/p/8V9jWkuJfaQ)]
|
||||||
- **<big>Unzip8</big>** : 根据传入的Tuple8切片,创建一组和Tuple8元素相对应的切片。
|
- **<big>Unzip8</big>** : 根据传入的Tuple8切片,创建一组和Tuple8元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip8)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip8)]
|
||||||
|
[[play](https://go.dev/play/p/1SndOwGsZB4)]
|
||||||
- **<big>Tuple9</big>** : 9 元元组
|
- **<big>Tuple9</big>** : 9 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple9)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple9)]
|
||||||
|
[[play](https://go.dev/play/p/yS2NGGtZpQr)]
|
||||||
- **<big>Tuple9_Unbox</big>** : 返回 9 元元组的字段值。
|
- **<big>Tuple9_Unbox</big>** : 返回 9 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple9_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple9_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/oFJFGTAuOa8)]
|
||||||
- **<big>Zip9</big>** : 创建一个 Tuple9 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip9</big>** : 创建一个 Tuple9 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip9)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip9)]
|
||||||
|
[[play](https://go.dev/play/p/cgsL15QYnfz)]
|
||||||
- **<big>Unzip9</big>** : 根据传入的Tuple9切片,创建一组和Tuple9元素相对应的切片。
|
- **<big>Unzip9</big>** : 根据传入的Tuple9切片,创建一组和Tuple9元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip9)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip9)]
|
||||||
|
[[play](https://go.dev/play/p/91-BU_KURSA)]
|
||||||
- **<big>Tuple10</big>** : 10 元元组
|
- **<big>Tuple10</big>** : 10 元元组
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple10)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple10)]
|
||||||
|
[[play](https://go.dev/play/p/799qqZg0hUv)]
|
||||||
- **<big>Tuple10_Unbox</big>** : 返回 10 元元组的字段值。
|
- **<big>Tuple10_Unbox</big>** : 返回 10 元元组的字段值。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple10_Unbox)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Tuple10_Unbox)]
|
||||||
|
[[play](https://go.dev/play/p/qfyx3x_X0Cu)]
|
||||||
- **<big>Zip10</big>** : 创建一个 Tuple10 元组切片, 其中元组的元素和传入切片元素相对应。
|
- **<big>Zip10</big>** : 创建一个 Tuple10 元组切片, 其中元组的元素和传入切片元素相对应。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip10)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Zip10)]
|
||||||
|
[[play](https://go.dev/play/p/YSR-2cXnrY4)]
|
||||||
- **<big>Unzip10</big>** : 根据传入的Tuple10切片,创建一组和Tuple10元素相对应的切片。
|
- **<big>Unzip10</big>** : 根据传入的Tuple10切片,创建一组和Tuple10元素相对应的切片。
|
||||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip10)]
|
[[doc](https://github.com/duke-git/lancet/blob/main/docs/tuple_zh-CN.md#Unzip10)]
|
||||||
|
[[play](https://go.dev/play/p/-taQB6Wfre_z)]
|
||||||
|
|
||||||
|
|
||||||
<h3 id="Validator"> 24. validator 验证器包,包含常用字符串格式验证函数。 <a href="#index">回到目录</a></h3>
|
<h3 id="Validator"> 24. validator 验证器包,包含常用字符串格式验证函数。 <a href="#index">回到目录</a></h3>
|
||||||
|
|
||||||
|
@@ -40,8 +40,8 @@ func Md5String(s string) string {
|
|||||||
return hex.EncodeToString(h.Sum(nil))
|
return hex.EncodeToString(h.Sum(nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Md5String return the md5 string of byte slice.
|
// Md5Byte return the md5 string of byte slice.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/suraalH8lyC
|
||||||
func Md5Byte(data []byte) string {
|
func Md5Byte(data []byte) string {
|
||||||
h := md5.New()
|
h := md5.New()
|
||||||
h.Write(data)
|
h.Write(data)
|
||||||
|
@@ -97,13 +97,13 @@ func GetNowDateTime() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetTodayStartTime return the start time of today, format: yyyy-mm-dd 00:00:00.
|
// GetTodayStartTime return the start time of today, format: yyyy-mm-dd 00:00:00.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/84siyYF7t99
|
||||||
func GetTodayStartTime() string {
|
func GetTodayStartTime() string {
|
||||||
return time.Now().Format("2006-01-02") + " 00:00:00"
|
return time.Now().Format("2006-01-02") + " 00:00:00"
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTodayEndTime return the end time of today, format: yyyy-mm-dd 23:59:59.
|
// GetTodayEndTime return the end time of today, format: yyyy-mm-dd 23:59:59.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/jjrLnfoqgn3
|
||||||
func GetTodayEndTime() string {
|
func GetTodayEndTime() string {
|
||||||
return time.Now().Format("2006-01-02") + " 23:59:59"
|
return time.Now().Format("2006-01-02") + " 23:59:59"
|
||||||
}
|
}
|
||||||
|
@@ -717,7 +717,7 @@ func main() {
|
|||||||
|
|
||||||
### <span id="GetTodayStartTime">GetTodayStartTime</span>
|
### <span id="GetTodayStartTime">GetTodayStartTime</span>
|
||||||
|
|
||||||
<p>返回当天开始时间, 格式: yyyy-mm-dd 00:00:00.</p>
|
<p>返回当天开始时间, 格式: yyyy-mm-dd 00:00:00。</p>
|
||||||
|
|
||||||
<b>函数签名:</b>
|
<b>函数签名:</b>
|
||||||
|
|
||||||
@@ -746,7 +746,7 @@ func main() {
|
|||||||
|
|
||||||
### <span id="GetTodayEndTime">GetTodayEndTime</span>
|
### <span id="GetTodayEndTime">GetTodayEndTime</span>
|
||||||
|
|
||||||
<p>返回当天结束时间,格式: yyyy-mm-dd 23:59:59.</p>
|
<p>返回当天结束时间,格式: yyyy-mm-dd 23:59:59。</p>
|
||||||
|
|
||||||
<b>函数签名:</b>
|
<b>函数签名:</b>
|
||||||
|
|
||||||
|
@@ -237,9 +237,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
t := tuple.NewTuple2(1, 0.1, "a")
|
t := tuple.NewTuple3(1, 0.1, "a")
|
||||||
v1, v2, v3 := t.Unbox()
|
v1, v2, v3 := t.Unbox()
|
||||||
fmt.Printf("%v %v %v", t.FieldA, t.FieldB, t.FieldC)
|
fmt.Printf("%v %v %v", v1, v2, v3)
|
||||||
|
|
||||||
// Output: 1 0.1 a
|
// Output: 1 0.1 a
|
||||||
}
|
}
|
||||||
@@ -1134,8 +1134,6 @@ func main() {
|
|||||||
fmt.Printf("%v %v %v %v %v %v %v %v %v %v", v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)
|
fmt.Printf("%v %v %v %v %v %v %v %v %v %v", v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)
|
||||||
|
|
||||||
// Output: 1 0.1 a true 2 2.2 b c map[a:1] {a}
|
// Output: 1 0.1 a true 2 2.2 b c map[a:1] {a}
|
||||||
|
|
||||||
// Output: 1 0.1 a true 2 2.2 b c map[a:1]
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -239,7 +239,7 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
t := tuple.NewTuple2(1, 0.1, "a")
|
t := tuple.NewTuple2(1, 0.1, "a")
|
||||||
v1, v2, v3 := t.Unbox()
|
v1, v2, v3 := t.Unbox()
|
||||||
fmt.Printf("%v %v %v", t.FieldA, t.FieldB, t.FieldC)
|
fmt.Printf("%v %v %v", v1, v2, v3)
|
||||||
|
|
||||||
// Output: 1 0.1 a
|
// Output: 1 0.1 a
|
||||||
}
|
}
|
||||||
@@ -1134,8 +1134,6 @@ func main() {
|
|||||||
fmt.Printf("%v %v %v %v %v %v %v %v %v %v", v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)
|
fmt.Printf("%v %v %v %v %v %v %v %v %v %v", v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)
|
||||||
|
|
||||||
// Output: 1 0.1 a true 2 2.2 b c map[a:1] {a}
|
// Output: 1 0.1 a true 2 2.2 b c map[a:1] {a}
|
||||||
|
|
||||||
// Output: 1 0.1 a true 2 2.2 b c map[a:1]
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -13,19 +13,19 @@ type Tuple2[A any, B any] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/0fD1qfCVwjm
|
||||||
func (t Tuple2[A, B]) Unbox() (A, B) {
|
func (t Tuple2[A, B]) Unbox() (A, B) {
|
||||||
return t.FieldA, t.FieldB
|
return t.FieldA, t.FieldB
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple2 creates a 2 elemnets tuple from a list of values.
|
// NewTuple2 creates a 2 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/3sHVqBQpLYN
|
||||||
func NewTuple2[A any, B any](a A, b B) Tuple2[A, B] {
|
func NewTuple2[A any, B any](a A, b B) Tuple2[A, B] {
|
||||||
return Tuple2[A, B]{FieldA: a, FieldB: b}
|
return Tuple2[A, B]{FieldA: a, FieldB: b}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip2 create a slice of Tuple2, whose elements are correspond to the given slice elements.
|
// Zip2 create a slice of Tuple2, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/4ncWJJ77Xio
|
||||||
func Zip2[A any, B any](a []A, b []B) []Tuple2[A, B] {
|
func Zip2[A any, B any](a []A, b []B) []Tuple2[A, B] {
|
||||||
size := mathutil.Max(len(a), len(b))
|
size := mathutil.Max(len(a), len(b))
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ func Zip2[A any, B any](a []A, b []B) []Tuple2[A, B] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip2 creates a group of slice from a slice of Tuple2.
|
// Unzip2 creates a group of slice from a slice of Tuple2.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/KBecr60feXb
|
||||||
func Unzip2[A any, B any](tuples []Tuple2[A, B]) ([]A, []B) {
|
func Unzip2[A any, B any](tuples []Tuple2[A, B]) ([]A, []B) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
@@ -65,19 +65,19 @@ type Tuple3[A any, B any, C any] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/YojLy-id1BS
|
||||||
func (t Tuple3[A, B, C]) Unbox() (A, B, C) {
|
func (t Tuple3[A, B, C]) Unbox() (A, B, C) {
|
||||||
return t.FieldA, t.FieldB, t.FieldC
|
return t.FieldA, t.FieldB, t.FieldC
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple3 creates a 3 elemnets tuple from a list of values.
|
// NewTuple3 creates a 3 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/FtH2sdCLlCf
|
||||||
func NewTuple3[A any, B any, C any](a A, b B, c C) Tuple3[A, B, C] {
|
func NewTuple3[A any, B any, C any](a A, b B, c C) Tuple3[A, B, C] {
|
||||||
return Tuple3[A, B, C]{FieldA: a, FieldB: b, FieldC: c}
|
return Tuple3[A, B, C]{FieldA: a, FieldB: b, FieldC: c}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip3 create a slice of Tuple3, whose elements are correspond to the given slice elements.
|
// Zip3 create a slice of Tuple3, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/97NgmsTILfu
|
||||||
func Zip3[A any, B any, C any](a []A, b []B, c []C) []Tuple3[A, B, C] {
|
func Zip3[A any, B any, C any](a []A, b []B, c []C) []Tuple3[A, B, C] {
|
||||||
size := mathutil.Max(len(a), len(b), len(c))
|
size := mathutil.Max(len(a), len(b), len(c))
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ func Zip3[A any, B any, C any](a []A, b []B, c []C) []Tuple3[A, B, C] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip3 creates a group of slice from a slice of Tuple3.
|
// Unzip3 creates a group of slice from a slice of Tuple3.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/bba4cpAa7KO
|
||||||
func Unzip3[A any, B any, C any](tuples []Tuple3[A, B, C]) ([]A, []B, []C) {
|
func Unzip3[A any, B any, C any](tuples []Tuple3[A, B, C]) ([]A, []B, []C) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
@@ -121,19 +121,19 @@ type Tuple4[A any, B any, C any, D any] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/ACj9YuACGgW
|
||||||
func (t Tuple4[A, B, C, D]) Unbox() (A, B, C, D) {
|
func (t Tuple4[A, B, C, D]) Unbox() (A, B, C, D) {
|
||||||
return t.FieldA, t.FieldB, t.FieldC, t.FieldD
|
return t.FieldA, t.FieldB, t.FieldC, t.FieldD
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple4 creates a 4 elemnets tuple from a list of values.
|
// NewTuple4 creates a 4 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/D2EqDz096tk
|
||||||
func NewTuple4[A any, B any, C any, D any](a A, b B, c C, d D) Tuple4[A, B, C, D] {
|
func NewTuple4[A any, B any, C any, D any](a A, b B, c C, d D) Tuple4[A, B, C, D] {
|
||||||
return Tuple4[A, B, C, D]{FieldA: a, FieldB: b, FieldC: c, FieldD: d}
|
return Tuple4[A, B, C, D]{FieldA: a, FieldB: b, FieldC: c, FieldD: d}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip4 create a slice of Tuple4, whose elements are correspond to the given slice elements.
|
// Zip4 create a slice of Tuple4, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/PEmTYVK5hL4
|
||||||
func Zip4[A any, B any, C any, D any](a []A, b []B, c []C, d []D) []Tuple4[A, B, C, D] {
|
func Zip4[A any, B any, C any, D any](a []A, b []B, c []C, d []D) []Tuple4[A, B, C, D] {
|
||||||
size := mathutil.Max(len(a), len(b), len(c), len(d))
|
size := mathutil.Max(len(a), len(b), len(c), len(d))
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ func Zip4[A any, B any, C any, D any](a []A, b []B, c []C, d []D) []Tuple4[A, B,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip4 creates a group of slice from a slice of Tuple4.
|
// Unzip4 creates a group of slice from a slice of Tuple4.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/rb8z4gyYSRN
|
||||||
func Unzip4[A any, B any, C any, D any](tuples []Tuple4[A, B, C, D]) ([]A, []B, []C, []D) {
|
func Unzip4[A any, B any, C any, D any](tuples []Tuple4[A, B, C, D]) ([]A, []B, []C, []D) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
@@ -181,19 +181,19 @@ type Tuple5[A any, B any, C any, D any, E any] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/GyIyZHjCvoS
|
||||||
func (t Tuple5[A, B, C, D, E]) Unbox() (A, B, C, D, E) {
|
func (t Tuple5[A, B, C, D, E]) Unbox() (A, B, C, D, E) {
|
||||||
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE
|
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple5 creates a 5 elemnets tuple from a list of values.
|
// NewTuple5 creates a 5 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/2WndmVxPg-r
|
||||||
func NewTuple5[A any, B any, C any, D any, E any](a A, b B, c C, d D, e E) Tuple5[A, B, C, D, E] {
|
func NewTuple5[A any, B any, C any, D any, E any](a A, b B, c C, d D, e E) Tuple5[A, B, C, D, E] {
|
||||||
return Tuple5[A, B, C, D, E]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e}
|
return Tuple5[A, B, C, D, E]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip5 create a slice of Tuple5, whose elements are correspond to the given slice elements.
|
// Zip5 create a slice of Tuple5, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/fCAAJLMfBIP
|
||||||
func Zip5[A any, B any, C any, D any, E any](a []A, b []B, c []C, d []D, e []E) []Tuple5[A, B, C, D, E] {
|
func Zip5[A any, B any, C any, D any, E any](a []A, b []B, c []C, d []D, e []E) []Tuple5[A, B, C, D, E] {
|
||||||
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e))
|
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e))
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ func Zip5[A any, B any, C any, D any, E any](a []A, b []B, c []C, d []D, e []E)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip5 creates a group of slice from a slice of Tuple5.
|
// Unzip5 creates a group of slice from a slice of Tuple5.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/gyl6vKfhqPb
|
||||||
func Unzip5[A any, B any, C any, D any, E any](tuples []Tuple5[A, B, C, D, E]) ([]A, []B, []C, []D, []E) {
|
func Unzip5[A any, B any, C any, D any, E any](tuples []Tuple5[A, B, C, D, E]) ([]A, []B, []C, []D, []E) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
@@ -247,19 +247,19 @@ type Tuple6[A any, B any, C any, D any, E any, F any] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/FjIHV7lpxmW
|
||||||
func (t Tuple6[A, B, C, D, E, F]) Unbox() (A, B, C, D, E, F) {
|
func (t Tuple6[A, B, C, D, E, F]) Unbox() (A, B, C, D, E, F) {
|
||||||
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF
|
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple6 creates a 6 elemnets tuple from a list of values.
|
// NewTuple6 creates a 6 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/VjqcCwEJZbs
|
||||||
func NewTuple6[A any, B any, C any, D any, E any, F any](a A, b B, c C, d D, e E, f F) Tuple6[A, B, C, D, E, F] {
|
func NewTuple6[A any, B any, C any, D any, E any, F any](a A, b B, c C, d D, e E, f F) Tuple6[A, B, C, D, E, F] {
|
||||||
return Tuple6[A, B, C, D, E, F]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f}
|
return Tuple6[A, B, C, D, E, F]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip6 create a slice of Tuple6, whose elements are correspond to the given slice elements.
|
// Zip6 create a slice of Tuple6, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/oWPrnUYuFHo
|
||||||
func Zip6[A any, B any, C any, D any, E any, F any](a []A, b []B, c []C, d []D, e []E, f []F) []Tuple6[A, B, C, D, E, F] {
|
func Zip6[A any, B any, C any, D any, E any, F any](a []A, b []B, c []C, d []D, e []E, f []F) []Tuple6[A, B, C, D, E, F] {
|
||||||
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f))
|
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f))
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ func Zip6[A any, B any, C any, D any, E any, F any](a []A, b []B, c []C, d []D,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip6 creates a group of slice from a slice of Tuple6.
|
// Unzip6 creates a group of slice from a slice of Tuple6.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/l41XFqCyh5E
|
||||||
func Unzip6[A any, B any, C any, D any, E any, F any](tuples []Tuple6[A, B, C, D, E, F]) ([]A, []B, []C, []D, []E, []F) {
|
func Unzip6[A any, B any, C any, D any, E any, F any](tuples []Tuple6[A, B, C, D, E, F]) ([]A, []B, []C, []D, []E, []F) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
@@ -317,19 +317,19 @@ type Tuple7[A any, B any, C any, D any, E any, F any, G any] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/R9I8qeDk0zs
|
||||||
func (t Tuple7[A, B, C, D, E, F, G]) Unbox() (A, B, C, D, E, F, G) {
|
func (t Tuple7[A, B, C, D, E, F, G]) Unbox() (A, B, C, D, E, F, G) {
|
||||||
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF, t.FieldG
|
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF, t.FieldG
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple7 creates a 7 elemnets tuple from a list of values.
|
// NewTuple7 creates a 7 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/dzAgv_Ezub9
|
||||||
func NewTuple7[A any, B any, C any, D any, E any, F any, G any](a A, b B, c C, d D, e E, f F, g G) Tuple7[A, B, C, D, E, F, G] {
|
func NewTuple7[A any, B any, C any, D any, E any, F any, G any](a A, b B, c C, d D, e E, f F, g G) Tuple7[A, B, C, D, E, F, G] {
|
||||||
return Tuple7[A, B, C, D, E, F, G]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f, FieldG: g}
|
return Tuple7[A, B, C, D, E, F, G]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f, FieldG: g}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip7 create a slice of Tuple7, whose elements are correspond to the given slice elements.
|
// Zip7 create a slice of Tuple7, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/WUJuo897Egf
|
||||||
func Zip7[A any, B any, C any, D any, E any, F any, G any](a []A, b []B, c []C, d []D, e []E, f []F, g []G) []Tuple7[A, B, C, D, E, F, G] {
|
func Zip7[A any, B any, C any, D any, E any, F any, G any](a []A, b []B, c []C, d []D, e []E, f []F, g []G) []Tuple7[A, B, C, D, E, F, G] {
|
||||||
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f), len(g))
|
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f), len(g))
|
||||||
|
|
||||||
@@ -354,7 +354,7 @@ func Zip7[A any, B any, C any, D any, E any, F any, G any](a []A, b []B, c []C,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip7 creates a group of slice from a slice of Tuple7.
|
// Unzip7 creates a group of slice from a slice of Tuple7.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/hws_P1Fr2j3
|
||||||
func Unzip7[A any, B any, C any, D any, E any, F any, G any](tuples []Tuple7[A, B, C, D, E, F, G]) ([]A, []B, []C, []D, []E, []F, []G) {
|
func Unzip7[A any, B any, C any, D any, E any, F any, G any](tuples []Tuple7[A, B, C, D, E, F, G]) ([]A, []B, []C, []D, []E, []F, []G) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
@@ -392,19 +392,19 @@ type Tuple8[A any, B any, C any, D any, E any, F any, G any, H any] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/PRxLBBb4SMl
|
||||||
func (t Tuple8[A, B, C, D, E, F, G, H]) Unbox() (A, B, C, D, E, F, G, H) {
|
func (t Tuple8[A, B, C, D, E, F, G, H]) Unbox() (A, B, C, D, E, F, G, H) {
|
||||||
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF, t.FieldG, t.FieldH
|
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF, t.FieldG, t.FieldH
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple8 creates a 8 elemnets tuple from a list of values.
|
// NewTuple8 creates a 8 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/YA9S0rz3dRz
|
||||||
func NewTuple8[A any, B any, C any, D any, E any, F any, G any, H any](a A, b B, c C, d D, e E, f F, g G, h H) Tuple8[A, B, C, D, E, F, G, H] {
|
func NewTuple8[A any, B any, C any, D any, E any, F any, G any, H any](a A, b B, c C, d D, e E, f F, g G, h H) Tuple8[A, B, C, D, E, F, G, H] {
|
||||||
return Tuple8[A, B, C, D, E, F, G, H]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f, FieldG: g, FieldH: h}
|
return Tuple8[A, B, C, D, E, F, G, H]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f, FieldG: g, FieldH: h}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip8 create a slice of Tuple8, whose elements are correspond to the given slice elements.
|
// Zip8 create a slice of Tuple8, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/8V9jWkuJfaQ
|
||||||
func Zip8[A any, B any, C any, D any, E any, F any, G any, H any](a []A, b []B, c []C, d []D, e []E, f []F, g []G, h []H) []Tuple8[A, B, C, D, E, F, G, H] {
|
func Zip8[A any, B any, C any, D any, E any, F any, G any, H any](a []A, b []B, c []C, d []D, e []E, f []F, g []G, h []H) []Tuple8[A, B, C, D, E, F, G, H] {
|
||||||
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f), len(g), len(h))
|
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f), len(g), len(h))
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ func Zip8[A any, B any, C any, D any, E any, F any, G any, H any](a []A, b []B,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip8 creates a group of slice from a slice of Tuple8.
|
// Unzip8 creates a group of slice from a slice of Tuple8.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/1SndOwGsZB4
|
||||||
func Unzip8[A any, B any, C any, D any, E any, F any, G any, H any](tuples []Tuple8[A, B, C, D, E, F, G, H]) ([]A, []B, []C, []D, []E, []F, []G, []H) {
|
func Unzip8[A any, B any, C any, D any, E any, F any, G any, H any](tuples []Tuple8[A, B, C, D, E, F, G, H]) ([]A, []B, []C, []D, []E, []F, []G, []H) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
@@ -471,19 +471,19 @@ type Tuple9[A any, B any, C any, D any, E any, F any, G any, H any, I any] struc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/oFJFGTAuOa8
|
||||||
func (t Tuple9[A, B, C, D, E, F, G, H, I]) Unbox() (A, B, C, D, E, F, G, H, I) {
|
func (t Tuple9[A, B, C, D, E, F, G, H, I]) Unbox() (A, B, C, D, E, F, G, H, I) {
|
||||||
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF, t.FieldG, t.FieldH, t.FieldI
|
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF, t.FieldG, t.FieldH, t.FieldI
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple9 creates a 9 elemnets tuple from a list of values.
|
// NewTuple9 creates a 9 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/yS2NGGtZpQr
|
||||||
func NewTuple9[A any, B any, C any, D any, E any, F any, G any, H any, I any](a A, b B, c C, d D, e E, f F, g G, h H, i I) Tuple9[A, B, C, D, E, F, G, H, I] {
|
func NewTuple9[A any, B any, C any, D any, E any, F any, G any, H any, I any](a A, b B, c C, d D, e E, f F, g G, h H, i I) Tuple9[A, B, C, D, E, F, G, H, I] {
|
||||||
return Tuple9[A, B, C, D, E, F, G, H, I]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f, FieldG: g, FieldH: h, FieldI: i}
|
return Tuple9[A, B, C, D, E, F, G, H, I]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f, FieldG: g, FieldH: h, FieldI: i}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip9 create a slice of Tuple9, whose elements are correspond to the given slice elements.
|
// Zip9 create a slice of Tuple9, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/cgsL15QYnfz
|
||||||
func Zip9[A any, B any, C any, D any, E any, F any, G any, H any, I any](a []A, b []B, c []C, d []D, e []E, f []F, g []G, h []H, i []I) []Tuple9[A, B, C, D, E, F, G, H, I] {
|
func Zip9[A any, B any, C any, D any, E any, F any, G any, H any, I any](a []A, b []B, c []C, d []D, e []E, f []F, g []G, h []H, i []I) []Tuple9[A, B, C, D, E, F, G, H, I] {
|
||||||
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f), len(g), len(h), len(i))
|
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f), len(g), len(h), len(i))
|
||||||
|
|
||||||
@@ -510,7 +510,7 @@ func Zip9[A any, B any, C any, D any, E any, F any, G any, H any, I any](a []A,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip9 creates a group of slice from a slice of Tuple9.
|
// Unzip9 creates a group of slice from a slice of Tuple9.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/91-BU_KURSA
|
||||||
func Unzip9[A any, B any, C any, D any, E any, F any, G any, H any, I any](tuples []Tuple9[A, B, C, D, E, F, G, H, I]) ([]A, []B, []C, []D, []E, []F, []G, []H, []I) {
|
func Unzip9[A any, B any, C any, D any, E any, F any, G any, H any, I any](tuples []Tuple9[A, B, C, D, E, F, G, H, I]) ([]A, []B, []C, []D, []E, []F, []G, []H, []I) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
@@ -554,19 +554,19 @@ type Tuple10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J an
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbox returns values in tuple.
|
// Unbox returns values in tuple.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/qfyx3x_X0Cu
|
||||||
func (t Tuple10[A, B, C, D, E, F, G, H, I, J]) Unbox() (A, B, C, D, E, F, G, H, I, J) {
|
func (t Tuple10[A, B, C, D, E, F, G, H, I, J]) Unbox() (A, B, C, D, E, F, G, H, I, J) {
|
||||||
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF, t.FieldG, t.FieldH, t.FieldI, t.FieldJ
|
return t.FieldA, t.FieldB, t.FieldC, t.FieldD, t.FieldE, t.FieldF, t.FieldG, t.FieldH, t.FieldI, t.FieldJ
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTuple10 creates a 10 elemnets tuple from a list of values.
|
// NewTuple10 creates a 10 elemnets tuple from a list of values.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/799qqZg0hUv
|
||||||
func NewTuple10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any](a A, b B, c C, d D, e E, f F, g G, h H, i I, j J) Tuple10[A, B, C, D, E, F, G, H, I, J] {
|
func NewTuple10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any](a A, b B, c C, d D, e E, f F, g G, h H, i I, j J) Tuple10[A, B, C, D, E, F, G, H, I, J] {
|
||||||
return Tuple10[A, B, C, D, E, F, G, H, I, J]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f, FieldG: g, FieldH: h, FieldI: i, FieldJ: j}
|
return Tuple10[A, B, C, D, E, F, G, H, I, J]{FieldA: a, FieldB: b, FieldC: c, FieldD: d, FieldE: e, FieldF: f, FieldG: g, FieldH: h, FieldI: i, FieldJ: j}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip10 create a slice of Tuple10, whose elements are correspond to the given slice elements.
|
// Zip10 create a slice of Tuple10, whose elements are correspond to the given slice elements.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/YSR-2cXnrY4
|
||||||
func Zip10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any](a []A, b []B, c []C, d []D, e []E, f []F, g []G, h []H, i []I, j []J) []Tuple10[A, B, C, D, E, F, G, H, I, J] {
|
func Zip10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any](a []A, b []B, c []C, d []D, e []E, f []F, g []G, h []H, i []I, j []J) []Tuple10[A, B, C, D, E, F, G, H, I, J] {
|
||||||
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f), len(g), len(h), len(i), len(j))
|
size := mathutil.Max(len(a), len(b), len(c), len(d), len(e), len(f), len(g), len(h), len(i), len(j))
|
||||||
|
|
||||||
@@ -595,7 +595,7 @@ func Zip10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any]
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unzip10 creates a group of slice from a slice of Tuple10.
|
// Unzip10 creates a group of slice from a slice of Tuple10.
|
||||||
// Play: todo
|
// Play: https://go.dev/play/p/-taQB6Wfre_z
|
||||||
func Unzip10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any](tuples []Tuple10[A, B, C, D, E, F, G, H, I, J]) ([]A, []B, []C, []D, []E, []F, []G, []H, []I, []J) {
|
func Unzip10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any](tuples []Tuple10[A, B, C, D, E, F, G, H, I, J]) ([]A, []B, []C, []D, []E, []F, []G, []H, []I, []J) {
|
||||||
size := len(tuples)
|
size := len(tuples)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user