mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-23 13:52:26 +08:00
Compare commits
7 Commits
v2.2.5
...
8ad374bb21
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ad374bb21 | ||
|
|
a69d886565 | ||
|
|
cf58542b4a | ||
|
|
51f166d1d9 | ||
|
|
fbeb031b40 | ||
|
|
095cfc0aab | ||
|
|
e66ab154bc |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -9,4 +9,6 @@ fileutil/unzip/*
|
||||
fileutil/tempdir/*
|
||||
slice/testdata/*
|
||||
cryptor/*.pem
|
||||
test
|
||||
test
|
||||
docs/node_modules
|
||||
docs/.vitepress/cache
|
||||
@@ -66,6 +66,7 @@ func GreaterOrEqual(left, right any) bool {
|
||||
}
|
||||
|
||||
// InDelta checks if two values are equal or not within a delta.
|
||||
// Play: https://go.dev/play/p/TuDdcNtMkjo
|
||||
func InDelta[T constraints.Integer | constraints.Float](left, right T, delta float64) bool {
|
||||
return float64(mathutil.Abs(left-right)) <= delta
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ func HmacMd5(str, key string) string {
|
||||
}
|
||||
|
||||
// HmacMd5WithBase64 return the hmac hash of string use md5 with base64.
|
||||
// todo
|
||||
// https://go.dev/play/p/UY0ng2AefFC
|
||||
func HmacMd5WithBase64(data, key string) string {
|
||||
h := hmac.New(md5.New, []byte(key))
|
||||
h.Write([]byte(data))
|
||||
|
||||
89
docs/.vitepress/common.ts
Normal file
89
docs/.vitepress/common.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import { defineConfig, HeadConfig } from 'vitepress'
|
||||
|
||||
export const META_IMAGE = '/lancet_logo.png'
|
||||
export const isProduction = process.env.NETLIFY && process.env.CONTEXT === 'production'
|
||||
|
||||
if (process.env.NETLIFY) {
|
||||
console.log('Netlify build', process.env.CONTEXT)
|
||||
}
|
||||
|
||||
const productionHead: HeadConfig[] = [
|
||||
[
|
||||
'script',
|
||||
{
|
||||
src: 'https://unpkg.com/thesemetrics@latest',
|
||||
async: '',
|
||||
type: 'text/javascript',
|
||||
},
|
||||
],
|
||||
]
|
||||
|
||||
const rControl = /[\u0000-\u001f]/g
|
||||
const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’<>,.?/]+/g
|
||||
const rCombining = /[\u0300-\u036F]/g
|
||||
|
||||
/**
|
||||
* Default slugification function
|
||||
*/
|
||||
export const slugify = (str: string): string =>
|
||||
str
|
||||
.normalize('NFKD')
|
||||
// Remove accents
|
||||
.replace(rCombining, '')
|
||||
// Remove control characters
|
||||
.replace(rControl, '')
|
||||
// Replace special characters
|
||||
.replace(rSpecial, '-')
|
||||
// ensure it doesn't start with a number
|
||||
.replace(/^(\d)/, '_$1')
|
||||
|
||||
export const commonConfig = defineConfig({
|
||||
title: 'Lancet',
|
||||
appearance: 'dark',
|
||||
|
||||
markdown: {
|
||||
theme: {
|
||||
dark: 'dracula-soft',
|
||||
light: 'vitesse-light',
|
||||
},
|
||||
|
||||
attrs: {
|
||||
leftDelimiter: '%{',
|
||||
rightDelimiter: '}%',
|
||||
},
|
||||
|
||||
anchor: {
|
||||
slugify,
|
||||
},
|
||||
},
|
||||
|
||||
head: [
|
||||
// ['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
|
||||
['link', { rel: 'icon', type: 'image/png', href: '/lancet_logo_mini.png' }],
|
||||
['meta', { name: 'theme-color', content: '#5f67ee' }],
|
||||
['meta', { name: 'og:type', content: 'website' }],
|
||||
['meta', { name: 'og:locale', content: 'zh' }],
|
||||
|
||||
...(isProduction ? productionHead : []),
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
logo: { src: '/lancet_logo_mini.png', width: 24, height: 24 },
|
||||
outline: [2, 3],
|
||||
|
||||
search: {
|
||||
provider: 'local',
|
||||
},
|
||||
socialLinks: [
|
||||
{
|
||||
icon: 'github',
|
||||
link: 'https://github.com/duke-git/lancet',
|
||||
},
|
||||
],
|
||||
|
||||
footer: {
|
||||
copyright: 'Copyright © 2023-present Duke Du',
|
||||
message: 'Released under the MIT License.',
|
||||
},
|
||||
},
|
||||
})
|
||||
14
docs/.vitepress/config.mts
Normal file
14
docs/.vitepress/config.mts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { defineConfig } from 'vitepress'
|
||||
import { commonConfig } from './common'
|
||||
import { zhConfig } from './zh'
|
||||
import { enConfig } from './en'
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default defineConfig({
|
||||
...commonConfig,
|
||||
|
||||
locales: {
|
||||
root: { label: '简体中文', lang: 'zh-CN', link: '/', ...zhConfig },
|
||||
en: { label: 'English', lang: 'en-US', link: '/en/', ...enConfig },
|
||||
},
|
||||
})
|
||||
91
docs/.vitepress/en.ts
Normal file
91
docs/.vitepress/en.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
|
||||
|
||||
export const META_URL = 'https://lancet.go.dev'
|
||||
export const META_TITLE = 'Lancet'
|
||||
export const META_DESCRIPTION = 'A powerful util function library of Go'
|
||||
|
||||
export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
|
||||
description: META_DESCRIPTION,
|
||||
|
||||
head: [
|
||||
['meta', { property: 'og:url', content: META_URL }],
|
||||
['meta', { property: 'og:description', content: META_DESCRIPTION }],
|
||||
['meta', { property: 'twitter:url', content: META_URL }],
|
||||
['meta', { property: 'twitter:title', content: META_TITLE }],
|
||||
['meta', { property: 'twitter:description', content: META_DESCRIPTION }],
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
nav: [
|
||||
{
|
||||
text: 'Home',
|
||||
link: '/en/',
|
||||
activeMatch: '^/en/',
|
||||
},
|
||||
{
|
||||
text: 'Guide',
|
||||
link: '/en/guide/introduction',
|
||||
activeMatch: '^/en/guide/',
|
||||
},
|
||||
{ text: 'API', link: '/en/api/overview', activeMatch: '^/en/api/' },
|
||||
{
|
||||
text: 'Links',
|
||||
items: [
|
||||
{
|
||||
text: 'Releaselog',
|
||||
link: 'https://github.com/duke-git/lancet/releases',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
sidebar: {
|
||||
'/en/': [
|
||||
{
|
||||
text: 'Introduction',
|
||||
items: [
|
||||
{
|
||||
text: 'What is Lancet?',
|
||||
link: '/en/guide/introduction',
|
||||
},
|
||||
{
|
||||
text: 'getting started',
|
||||
link: '/en/guide/getting_started',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'/en/api/': [
|
||||
{
|
||||
text: 'overview',
|
||||
items: [{ text: 'overview of API', link: '/en/api/overview' }],
|
||||
},
|
||||
{
|
||||
text: 'packages',
|
||||
items: [
|
||||
{ text: 'algorithm', link: '/en/api/packages/algorithm' },
|
||||
{ text: 'compare', link: '/en/api/packages/compare' },
|
||||
{ text: 'concurrency', link: '/en/api/packages/concurrency' },
|
||||
{ text: 'condition', link: '/en/api/packages/condition' },
|
||||
{ text: 'convertor', link: '/en/api/packages/convertor' },
|
||||
{ text: 'cryptor', link: '/en/api/packages/cryptor' },
|
||||
{
|
||||
text: 'datastructure',
|
||||
items: [
|
||||
{ text: 'list', link: '/en/api/packages/datastructure/list' },
|
||||
{ text: 'safelist', link: '/en/api/packages/datastructure/copyonwritelist' },
|
||||
{ text: 'link', link: '/en/api/packages/datastructure/link' },
|
||||
{ text: 'stack', link: '/en/api/packages/datastructure/stack' },
|
||||
{ text: 'queue', link: '/en/api/packages/datastructure/queue' },
|
||||
{ text: 'heap', link: '/en/api/packages/datastructure/heap' },
|
||||
{ text: 'tree', link: '/en/api/packages/datastructure/tree' },
|
||||
{ text: 'set', link: '/en/api/packages/datastructure/set' },
|
||||
{ text: 'hashmap', link: '/en/api/packages/datastructure/hashmap' },
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
101
docs/.vitepress/zh.ts
Normal file
101
docs/.vitepress/zh.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
|
||||
|
||||
export const META_URL = 'https://lancet.go.dev'
|
||||
export const META_TITLE = 'Lancet'
|
||||
export const META_DESCRIPTION = '一个强大的Go语言工具函数库'
|
||||
|
||||
export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
|
||||
description: META_DESCRIPTION,
|
||||
|
||||
head: [
|
||||
['meta', { property: 'og:url', content: META_URL }],
|
||||
['meta', { property: 'og:description', content: META_DESCRIPTION }],
|
||||
['meta', { property: 'twitter:url', content: META_URL }],
|
||||
['meta', { property: 'twitter:title', content: META_TITLE }],
|
||||
['meta', { property: 'twitter:description', content: META_DESCRIPTION }],
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
outline: {
|
||||
label: '本页内容',
|
||||
},
|
||||
|
||||
docFooter: {
|
||||
prev: '上一页',
|
||||
next: '下一页',
|
||||
},
|
||||
|
||||
nav: [
|
||||
{
|
||||
text: '首页',
|
||||
link: '/',
|
||||
activeMatch: '^/',
|
||||
},
|
||||
{
|
||||
text: '指南',
|
||||
link: '/guide/introduction',
|
||||
activeMatch: '^/guide/',
|
||||
},
|
||||
{ text: 'API', link: '/api/overview', activeMatch: '^/api/' },
|
||||
{
|
||||
text: '相关链接',
|
||||
items: [
|
||||
{
|
||||
text: '更新日志',
|
||||
link: 'https://github.com/duke-git/lancet/releases',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
sidebar: {
|
||||
'/': [
|
||||
{
|
||||
text: '介绍',
|
||||
items: [
|
||||
{
|
||||
text: 'Lancet是什么?',
|
||||
link: '/guide/introduction',
|
||||
},
|
||||
{
|
||||
text: '开始',
|
||||
link: '/guide/getting_started',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
'/api/': [
|
||||
{
|
||||
text: '概览',
|
||||
items: [{ text: 'API概述', link: '/api/overview' }],
|
||||
},
|
||||
{
|
||||
text: 'API文档',
|
||||
items: [
|
||||
{ text: '算法', link: '/api/packages/algorithm' },
|
||||
{ text: '比较器', link: '/api/packages/compare' },
|
||||
{ text: '并发处理', link: '/api/packages/concurrency' },
|
||||
{ text: '条件判断', link: '/api/packages/condition' },
|
||||
{ text: '类型转换', link: '/api/packages/convertor' },
|
||||
{ text: '加密&解密', link: '/api/packages/cryptor' },
|
||||
{
|
||||
text: '数据结构',
|
||||
items: [
|
||||
{ text: '线性表', link: '/api/packages/datastructure/list' },
|
||||
{ text: '线性表(线程安全)', link: '/api/packages/datastructure/copyonwritelist' },
|
||||
{ text: '链表', link: '/api/packages/datastructure/link' },
|
||||
{ text: '栈', link: '/api/packages/datastructure/stack' },
|
||||
{ text: '队列', link: '/api/packages/datastructure/queue' },
|
||||
{ text: '堆', link: '/api/packages/datastructure/heap' },
|
||||
{ text: '树', link: '/api/packages/datastructure/tree' },
|
||||
{ text: '集合', link: '/api/packages/datastructure/set' },
|
||||
{ text: 'HashMap', link: '/api/packages/datastructure/hashmap' },
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
69
docs/api/overview.md
Normal file
69
docs/api/overview.md
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# API概述
|
||||
|
||||
<b>lancet(柳叶刀)是一个强大、全面、高效、可复用的go语言工具函数库。包含25个包,超过600个工具函数。功能涵盖字符串处理、切片处理、网络、并发、加解密、文件处理、时间/日期、流处理、迭代器等等。</b>
|
||||
|
||||
|
||||
<style>
|
||||
.package-title {
|
||||
color: black;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
.package-container {
|
||||
font-size: 16px;
|
||||
border: 1px dashed;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.package-cell {
|
||||
height: 40px;
|
||||
width: 140px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
line-height: 40px;
|
||||
background: #ecefff;
|
||||
border: 1px solid;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
<p class="package-title">lancet功能模块</p>
|
||||
<div class="package-container">
|
||||
<div class="package-cell">algorithm</div>
|
||||
<div class="package-cell">compare</div>
|
||||
<div class="package-cell">concurrency</div>
|
||||
<div class="package-cell">condition</div>
|
||||
<div class="package-cell">convertor</div>
|
||||
<div class="package-cell">cryptor</div>
|
||||
<div class="package-cell">datastructure</div>
|
||||
<div class="package-cell">datetime</div>
|
||||
<div class="package-cell">fileutil</div>
|
||||
<div class="package-cell">formatter</div>
|
||||
<div class="package-cell">function</div>
|
||||
<div class="package-cell">iterator</div>
|
||||
<div class="package-cell">maputil</div>
|
||||
<div class="package-cell">mathutil</div>
|
||||
<div class="package-cell">netutil</div>
|
||||
<div class="package-cell">pointer</div>
|
||||
<div class="package-cell">random</div>
|
||||
<div class="package-cell">retry</div>
|
||||
<div class="package-cell">slice</div>
|
||||
<div class="package-cell">stream</div>
|
||||
<div class="package-cell">structs</div>
|
||||
<div class="package-cell">strutil</div>
|
||||
<div class="package-cell">system</div>
|
||||
<div class="package-cell">tuple</div>
|
||||
<div class="package-cell">validator</div>
|
||||
<div class="package-cell">xerror</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,6 +39,8 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## 文档
|
||||
|
||||
### <span id="BubbleSort">BubbleSort</span>
|
||||
@@ -51,7 +53,7 @@ import (
|
||||
func BubbleSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/GNdv7Jg2Taj)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -99,7 +101,7 @@ func main() {
|
||||
func InsertionSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/G5LJiWgJJW6)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -162,7 +164,7 @@ func main() {
|
||||
func SelectionSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/oXovbkekayS)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -210,7 +212,7 @@ func main() {
|
||||
func ShellSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/3ibkszpJEu3)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -258,7 +260,7 @@ func main() {
|
||||
func QuickSort[T any](slice []T comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/7Y7c1Elk3ax)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -306,7 +308,7 @@ func main() {
|
||||
func HeapSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/u6Iwa1VZS_f)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -354,7 +356,7 @@ func main() {
|
||||
func MergeSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/ydinn9YzUJn)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -402,7 +404,7 @@ func main() {
|
||||
func CountSort[T any](slice []T, comparator lancetconstraints.Comparator) []T
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/tB-Umgm0DrP)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -451,7 +453,7 @@ func main() {
|
||||
func BinarySearch[T any](sortedSlice []T, target T, lowIndex, highIndex int, comparator lancetconstraints.Comparator) int
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/t6MeGiUSN47)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -502,7 +504,7 @@ func main() {
|
||||
func BinaryIterativeSearch[T any](sortedSlice []T, target T, lowIndex, highIndex int, comparator lancetconstraints.Comparator) int
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/Anozfr8ZLH3)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -553,7 +555,7 @@ func main() {
|
||||
func LinearSearch[T any](slice []T, target T, equal func(a, b T) bool) int
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/IsS7rgn5s3x)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -596,7 +598,7 @@ func (l *LRUCache[K, V]) Delete(key K) bool
|
||||
func (l *LRUCache[K, V]) Len() int
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/-EZjgOURufP)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -35,7 +35,9 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
## Documentation
|
||||
<link rel="stylesheet" type="text/css" href="../../styles/api_doc.css">
|
||||
|
||||
## 文档
|
||||
|
||||
### <span id="Equal">Equal</span>
|
||||
|
||||
@@ -47,7 +49,7 @@ import (
|
||||
func Equal(left, right any) bool
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/wmVxR-to4lz)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -96,7 +98,7 @@ func main() {
|
||||
func EqualValue(left, right any) bool
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/fxnna_LLD9u)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -135,7 +137,7 @@ func main() {
|
||||
func LessThan(left, right any) bool
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/cYh7FQQj0ne)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -184,7 +186,7 @@ func main() {
|
||||
func GreaterThan(left, right any) bool
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/9-NYDFZmIMp)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -236,7 +238,7 @@ func main() {
|
||||
func LessOrEqual(left, right any) bool
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/e4T_scwoQzp)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -285,7 +287,7 @@ func main() {
|
||||
func GreaterOrEqual(left, right any) bool
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/vx8mP0U8DFk)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -337,7 +339,7 @@ func main() {
|
||||
func InDelta[T constraints.Integer | constraints.Float](left, right T, delta float64) bool
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例: <span class="run-container">[运行](https://go.dev/play/p/TuDdcNtMkjo)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -33,11 +33,15 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## 文档
|
||||
|
||||
|
||||
### Channel
|
||||
|
||||
### <span id="NewChannel">NewChannel</span>
|
||||
|
||||
<p>返回一个Channel指针实例</p>
|
||||
|
||||
<b>函数签名:</b>
|
||||
@@ -46,7 +50,7 @@ import (
|
||||
type Channel[T any] struct
|
||||
func NewChannel[T any]() *Channel[T]
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/7aB4KyMMp9A)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -70,7 +74,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) Bridge(ctx context.Context, chanStream <-chan <-chan T) <-chan T
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/qmWSy1NVF-Y)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -122,7 +126,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) FanIn(ctx context.Context, channels ...<-chan T) <-chan T
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/2VYFMexEvTm)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -161,7 +165,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) Generate(ctx context.Context, values ...T) <-chan T
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/7aB4KyMMp9A)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -199,7 +203,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) Repeat(ctx context.Context, values ...T) <-chan T
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/k5N_ALVmYjE)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -238,7 +242,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) RepeatFn(ctx context.Context, fn func() T) <-chan T
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/4J1zAWttP85)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -279,7 +283,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) Or(channels ...<-chan T) <-chan T
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/Wqz9rwioPww)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -322,7 +326,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) OrDone(ctx context.Context, channel <-chan T) <-chan T
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/lm_GoS6aDjo)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -360,7 +364,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) Take(ctx context.Context, valueStream <-chan T, number int) <-chan T
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/9Utt-1pDr2J)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -406,7 +410,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) Tee(ctx context.Context, in <-chan T) (<-chan T, <-chan T)
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/3TQPKnCirrP)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
## Index
|
||||
## 目录
|
||||
|
||||
- [Bool](#Bool)
|
||||
- [And](#And)
|
||||
@@ -31,7 +31,9 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
## 目录
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## 文档
|
||||
|
||||
### <span id="Bool">Bool</span>
|
||||
<p>返回传入参数的bool值.<br/>
|
||||
@@ -45,7 +47,7 @@ slices和map的length大于0时,返回true,否则返回false<br/>
|
||||
```go
|
||||
func Bool[T any](value T) bool
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/ETzeDJRSvhm)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -109,7 +111,7 @@ func main() {
|
||||
```go
|
||||
func And[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/W1SSUmt6pvr)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -135,7 +137,7 @@ func main() {
|
||||
```go
|
||||
func Or[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/UlQTxHaeEkq)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -161,7 +163,7 @@ func main() {
|
||||
```go
|
||||
func Xor[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/gObZrW7ZbG8)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -187,7 +189,7 @@ func main() {
|
||||
```go
|
||||
func Nor[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/g2j08F_zZky)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -213,7 +215,7 @@ func main() {
|
||||
```go
|
||||
func Xnor[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/OuDB9g51643)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -239,7 +241,7 @@ func main() {
|
||||
```go
|
||||
func Nand[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/vSRMLxLIbq8)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -265,7 +267,7 @@ func main() {
|
||||
```go
|
||||
func TernaryOperator[T, U any](isTrue T, ifValue U, elseValue U) U
|
||||
```
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/ElllPZY0guT)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -46,6 +46,8 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## 文档
|
||||
|
||||
### <span id="ColorHexToRGB">ColorHexToRGB</span>
|
||||
@@ -58,7 +60,7 @@ import (
|
||||
func ColorHexToRGB(colorHex string) (red, green, blue int)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/o7_ft-JCJBV)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -89,7 +91,7 @@ func main() {
|
||||
func ColorRGBToHex(red, green, blue int) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/nzKS2Ro87J1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -122,7 +124,7 @@ func main() {
|
||||
func ToBool(s string) (bool, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/ARht2WnGdIN)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -163,7 +165,7 @@ func main() {
|
||||
func ToBytes(data any) ([]byte, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/fAMXYFDvOvr)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -196,7 +198,7 @@ func main() {
|
||||
func ToChar(s string) []string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/JJ1SvbFkVdM)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -232,7 +234,7 @@ func main() {
|
||||
func ToChannel[T any](array []T) <-chan T
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/hOx_oYZbAnL)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -269,7 +271,7 @@ func main() {
|
||||
func ToFloat(value any) (float64, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/4YTmPCibqHJ)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -314,7 +316,7 @@ func main() {
|
||||
func ToInt(value any) (int64, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/9_h9vIt-QZ_b)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -356,7 +358,7 @@ func main() {
|
||||
func ToJson(value any) (string, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/2rLIkMmXWvR)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -391,7 +393,7 @@ func main() {
|
||||
func ToMap[T any, K comparable, V any](array []T, iteratee func(T) (K, V)) map[K]V
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/tVFy7E-t24l)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -432,7 +434,7 @@ func main() {
|
||||
func ToPointer[T any](value T) *T
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/ASf_etHNlw1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -461,7 +463,7 @@ func main() {
|
||||
func ToString(value any) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/nF1zOOslpQq)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -509,7 +511,7 @@ func main() {
|
||||
func StructToMap(value any) (map[string]any, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/KYGYJqNUBOI)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -547,7 +549,7 @@ func main() {
|
||||
func MapToSlice[T any, K comparable, V any](aMap map[K]V, iteratee func(K, V) T) []T
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/dmX4Ix5V6Wl)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -577,7 +579,7 @@ func main() {
|
||||
func EncodeByte(data any) ([]byte, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/DVmM1G5JfuP)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -606,7 +608,7 @@ func main() {
|
||||
func DecodeByte(data []byte, target any) error
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/zI6xsmuQRbn)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -642,7 +644,7 @@ func main() {
|
||||
func DeepClone[T any](src T) T
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/j4DP5dquxnk)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -706,7 +708,7 @@ func main() {
|
||||
func CopyProperties[T, U any](dst T, src U) (err error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/oZujoB5Sgg5)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -785,7 +787,7 @@ func main() {
|
||||
func ToInterface(v reflect.Value) (value interface{}, ok bool)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/syqw0-WG7Xd)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -820,7 +822,7 @@ func main() {
|
||||
func Utf8ToGbk(bs []byte) ([]byte, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/9FlIaFLArIL)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -854,7 +856,7 @@ func main() {
|
||||
func GbkToUtf8(bs []byte) ([]byte, error)
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/OphmHCN_9u8)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1,16 +1,18 @@
|
||||
# Cryptor
|
||||
cryptor加密包支持数据加密和解密,获取md5,hash值。支持base64, md5, hmac, aes, des, rsa。
|
||||
|
||||
cryptor包包含数据加密和解密功能。支持 base64, md5, hmac, hash, aes, des, rsa。
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
## 源码:
|
||||
|
||||
- [https://github.com/duke-git/lancet/blob/main/cryptor/basic.go](https://github.com/duke-git/lancet/blob/main/cryptor/basic.go)
|
||||
- [https://github.com/duke-git/lancet/blob/main/cryptor/crypto.go](https://github.com/duke-git/lancet/blob/main/cryptor/crypto.go)
|
||||
- [https://github.com/duke-git/lancet/blob/main/cryptor/basic.go](https://github.com/duke-git/lancet/blob/main/cryptor/basic.go)
|
||||
- [https://github.com/duke-git/lancet/blob/main/cryptor/crypto.go](https://github.com/duke-git/lancet/blob/main/cryptor/crypto.go)
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
## 用法:
|
||||
|
||||
```go
|
||||
import (
|
||||
"github.com/duke-git/lancet/v2/cryptor"
|
||||
@@ -20,56 +22,56 @@ import (
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
## 目录
|
||||
- [AesEcbEncrypt](#AesEcbEncrypt)
|
||||
- [AesEcbDecrypt](#AesEcbDecrypt)
|
||||
- [AesCbcEncrypt](#AesCbcEncrypt)
|
||||
- [AesCbcDecrypt](#AesCbcDecrypt)
|
||||
- [AesCtrCrypt](#AesCtrCrypt)
|
||||
- [AesCfbEncrypt](#AesCfbEncrypt)
|
||||
- [AesCfbDecrypt](#AesCfbDecrypt)
|
||||
- [AesOfbEncrypt](#AesOfbEncrypt)
|
||||
- [AesOfbDecrypt](#AesOfbDecrypt)
|
||||
- [Base64StdEncode](#Base64StdEncode)
|
||||
- [Base64StdDecode](#Base64StdDecode)
|
||||
- [DesEcbEncrypt](#DesEcbEncrypt)
|
||||
- [DesEcbDecrypt](#DesEcbDecrypt)
|
||||
- [DesCbcEncrypt](#DesCbcEncrypt)
|
||||
- [DesCbcDecrypt](#DesCbcDecrypt)
|
||||
- [DesCtrCrypt](#DesCtrCrypt)
|
||||
- [DesCfbEncrypt](#DesCfbEncrypt)
|
||||
- [DesCfbDecrypt](#DesCfbDecrypt)
|
||||
- [DesOfbEncrypt](#DesOfbEncrypt)
|
||||
- [DesOfbDecrypt](#DesOfbDecrypt)
|
||||
- [HmacMd5](#HmacMd5)
|
||||
- [HmacMd5WithBase64](#HmacMd5WithBase64)
|
||||
- [HmacSha1](#HmacSha1)
|
||||
- [HmacSha1WithBase64](#HmacSha1WithBase64)
|
||||
- [HmacSha256](#HmacSha256)
|
||||
- [HmacSha256WithBase64](#HmacSha256WithBase64)
|
||||
- [HmacSha512](#HmacSha512)
|
||||
- [HmacSha512WithBase64](#HmacSha512WithBase64)
|
||||
- [Md5String](#Md5String)
|
||||
- [Md5StringWithBase64](#Md5StringWithBase64)
|
||||
- [Md5Byte](#Md5Byte)
|
||||
- [Md5ByteWithBase64](#Md5ByteWithBase64)
|
||||
- [Md5File](#Md5File)
|
||||
- [Sha1](#Sha1)
|
||||
- [Sha1WithBase64](#Sha1WithBase64)
|
||||
- [Sha256](#Sha256)
|
||||
- [Sha256WithBase64](#Sha256WithBase64)
|
||||
- [Sha512](#Sha512)
|
||||
- [Sha512WithBase64](#Sha512WithBase64)
|
||||
- [GenerateRsaKey](#GenerateRsaKey)
|
||||
- [RsaEncrypt](#RsaEncrypt)
|
||||
- [RsaDecrypt](#RsaDecrypt)
|
||||
|
||||
- [AesEcbEncrypt](#AesEcbEncrypt)
|
||||
- [AesEcbDecrypt](#AesEcbDecrypt)
|
||||
- [AesCbcEncrypt](#AesCbcEncrypt)
|
||||
- [AesCbcDecrypt](#AesCbcDecrypt)
|
||||
- [AesCtrCrypt](#AesCtrCrypt)
|
||||
- [AesCfbEncrypt](#AesCfbEncrypt)
|
||||
- [AesCfbDecrypt](#AesCfbDecrypt)
|
||||
- [AesOfbEncrypt](#AesOfbEncrypt)
|
||||
- [AesOfbDecrypt](#AesOfbDecrypt)
|
||||
- [Base64StdEncode](#Base64StdEncode)
|
||||
- [Base64StdDecode](#Base64StdDecode)
|
||||
- [DesEcbEncrypt](#DesEcbEncrypt)
|
||||
- [DesEcbDecrypt](#DesEcbDecrypt)
|
||||
- [DesCbcEncrypt](#DesCbcEncrypt)
|
||||
- [DesCbcDecrypt](#DesCbcDecrypt)
|
||||
- [DesCtrCrypt](#DesCtrCrypt)
|
||||
- [DesCfbEncrypt](#DesCfbEncrypt)
|
||||
- [DesCfbDecrypt](#DesCfbDecrypt)
|
||||
- [DesOfbEncrypt](#DesOfbEncrypt)
|
||||
- [DesOfbDecrypt](#DesOfbDecrypt)
|
||||
- [HmacMd5](#HmacMd5)
|
||||
- [HmacMd5WithBase64](#HmacMd5WithBase64)
|
||||
- [HmacSha1](#HmacSha1)
|
||||
- [HmacSha1WithBase64](#HmacSha1WithBase64)
|
||||
- [HmacSha256](#HmacSha256)
|
||||
- [HmacSha256WithBase64](#HmacSha256WithBase64)
|
||||
- [HmacSha512](#HmacSha512)
|
||||
- [HmacSha512WithBase64](#HmacSha512WithBase64)
|
||||
- [Md5String](#Md5String)
|
||||
- [Md5StringWithBase64](#Md5StringWithBase64)
|
||||
- [Md5Byte](#Md5Byte)
|
||||
- [Md5ByteWithBase64](#Md5ByteWithBase64)
|
||||
- [Md5File](#Md5File)
|
||||
- [Sha1](#Sha1)
|
||||
- [Sha1WithBase64](#Sha1WithBase64)
|
||||
- [Sha256](#Sha256)
|
||||
- [Sha256WithBase64](#Sha256WithBase64)
|
||||
- [Sha512](#Sha512)
|
||||
- [Sha512WithBase64](#Sha512WithBase64)
|
||||
- [GenerateRsaKey](#GenerateRsaKey)
|
||||
- [RsaEncrypt](#RsaEncrypt)
|
||||
- [RsaDecrypt](#RsaDecrypt)
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## 文档
|
||||
|
||||
|
||||
|
||||
### <span id="AesEcbEncrypt">AesEcbEncrypt</span>
|
||||
|
||||
<p>使用AES ECB算法模式加密数据. 参数`key`的长度是16, 24 or 32。</p>
|
||||
@@ -79,7 +81,8 @@ import (
|
||||
```go
|
||||
func AesEcbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
<b>示例:</b>
|
||||
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/zI6xsmuQRbn)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -112,7 +115,8 @@ func main() {
|
||||
```go
|
||||
func AesEcbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
<b>示例:</b>
|
||||
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/zI6xsmuQRbn)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -145,7 +149,8 @@ func main() {
|
||||
```go
|
||||
func AesCbcEncrypt(data, key []byte) []byte
|
||||
```
|
||||
<b>示例:</b>
|
||||
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/IOq_g8_lKZD)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -179,7 +184,7 @@ func main() {
|
||||
func AesCbcDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/IOq_g8_lKZD)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -213,7 +218,7 @@ func main() {
|
||||
func AesCtrCrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/SpaZO0-5Nsp)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -247,7 +252,7 @@ func main() {
|
||||
func AesCfbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/tfkF10B13kH)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -281,7 +286,7 @@ func main() {
|
||||
func AesCfbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/tfkF10B13kH)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -315,7 +320,7 @@ func main() {
|
||||
func AesOfbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/VtHxtkUj-3F)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -338,6 +343,7 @@ func main() {
|
||||
// hello
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="AesCfbDecrypt">AesOfbDecrypt</span>
|
||||
|
||||
<p>使用AES OFB算法模式解密数据,参数`key`的长度是16, 24 or 32。</p>
|
||||
@@ -348,7 +354,7 @@ func main() {
|
||||
func AesOfbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/VtHxtkUj-3F)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -381,7 +387,8 @@ func main() {
|
||||
```go
|
||||
func Base64StdEncode(s string) string
|
||||
```
|
||||
<b>示例:</b>
|
||||
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/VOaUyQUreoK)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -399,6 +406,7 @@ func main() {
|
||||
// aGVsbG8=
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="Base64StdDecode">Base64StdDecode</span>
|
||||
|
||||
<p>解码base64字符串。</p>
|
||||
@@ -409,7 +417,7 @@ func main() {
|
||||
func Base64StdDecode(s string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/RWQylnJVgIe)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -438,7 +446,7 @@ func main() {
|
||||
func DesEcbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/8qivmPeZy4P)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -462,6 +470,7 @@ func main() {
|
||||
// hello
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="DesEcbDecrypt">DesEcbDecrypt</span>
|
||||
|
||||
<p>使用DES ECB算法模式解决密数据,参数`key`的长度是8。</p>
|
||||
@@ -472,7 +481,7 @@ func main() {
|
||||
func DesEcbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/8qivmPeZy4P)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -507,7 +516,7 @@ func main() {
|
||||
func DesCbcEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/4cC4QvWfe3_1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -541,7 +550,7 @@ func main() {
|
||||
func DesCbcDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/4cC4QvWfe3_1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -564,6 +573,7 @@ func main() {
|
||||
// hello
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="DesCtrCrypt">DesCtrCrypt</span>
|
||||
|
||||
<p>使用DES CTR算法模式加密/解密数据,参数`key`的长度是8</p>
|
||||
@@ -574,7 +584,7 @@ func main() {
|
||||
func DesCtrCrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/9-T6OjKpcdw)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -608,7 +618,7 @@ func main() {
|
||||
func DesCfbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/y-eNxcFBlxL)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -631,6 +641,7 @@ func main() {
|
||||
// hello
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="DesCfbDecrypt">DesCfbDecrypt</span>
|
||||
|
||||
<p>使用DES CFB算法模式解决密数据,参数`key`的长度是8。</p>
|
||||
@@ -641,7 +652,7 @@ func main() {
|
||||
func DesCfbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/y-eNxcFBlxL)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -664,6 +675,7 @@ func main() {
|
||||
// hello
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="DesOfbEncrypt">DesOfbEncrypt</span>
|
||||
|
||||
<p>使用DES OFB算法模式加密数据,参数`key`的长度是8。</p>
|
||||
@@ -674,7 +686,7 @@ func main() {
|
||||
func DesOfbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/74KmNadjN1J)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -697,6 +709,7 @@ func main() {
|
||||
// hello
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="DesOfbDecrypt">DesOfbDecrypt</span>
|
||||
|
||||
<p>使用DES OFB算法模式解密数据,参数`key`的长度是8。</p>
|
||||
@@ -707,7 +720,7 @@ func main() {
|
||||
func DesOfbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/74KmNadjN1J)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -741,7 +754,7 @@ func main() {
|
||||
func HmacMd5(str, key string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/uef0q1fz53I)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -773,7 +786,7 @@ func main() {
|
||||
func HmacMd5WithBase64(str, key string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/UY0ng2AefFC)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -794,6 +807,7 @@ func main() {
|
||||
// 6DQwbquJLYclJdSRinpjmg==
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="HmacSha1">HmacSha1</span>
|
||||
|
||||
<p>获取字符串的sha1 hmac值。</p>
|
||||
@@ -804,7 +818,7 @@ func main() {
|
||||
func HmacSha1(str, key string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/1UI4oQ4WXKM)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -836,7 +850,7 @@ func main() {
|
||||
func HmacSha1WithBase64(str, key string) string
|
||||
```
|
||||
|
||||
<b>实例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/47JmmGrnF7B)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -858,7 +872,6 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### <span id="HmacSha256">HmacSha256</span>
|
||||
|
||||
<p>获取字符串sha256 hmac值。</p>
|
||||
@@ -869,7 +882,7 @@ func main() {
|
||||
func HmacSha256(str, key string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/HhpwXxFhhC0)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -901,7 +914,7 @@ func main() {
|
||||
func HmacSha256WithBase64(str, key string) string
|
||||
```
|
||||
|
||||
<b>实例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/EKbkUvPTLwO)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -933,7 +946,7 @@ func main() {
|
||||
func HmacSha512(str, key string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/59Od6m4A0Ud)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -965,7 +978,7 @@ func main() {
|
||||
func HmacSha512WithBase64(str, key string) string
|
||||
```
|
||||
|
||||
<b>实例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/c6dSe3E2ydU)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -987,7 +1000,6 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### <span id="Md5String">Md5String</span>
|
||||
|
||||
<p>获取字符串md5值。</p>
|
||||
@@ -998,7 +1010,7 @@ func main() {
|
||||
func Md5String(str string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/1bLcVetbTOI)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1029,7 +1041,7 @@ func main() {
|
||||
func Md5StringWithBase64(s string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/Tcb-Z7LN2ax)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1058,7 +1070,7 @@ func main() {
|
||||
func Md5Byte(data []byte) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/suraalH8lyC)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1087,7 +1099,7 @@ func main() {
|
||||
func Md5ByteWithBase64(data []byte) string
|
||||
```
|
||||
|
||||
<b>实例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/Lx4gH7Vdr5_y)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1142,7 +1154,7 @@ func main() {
|
||||
func Sha1(str string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/_m_uoD1deMT)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1173,7 +1185,7 @@ func main() {
|
||||
func Sha1WithBase64(str string) string
|
||||
```
|
||||
|
||||
<b>实例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/fSyx-Gl2l2-)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1202,7 +1214,7 @@ func main() {
|
||||
func Sha256(str string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/tU9tfBMIAr1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1233,7 +1245,7 @@ func main() {
|
||||
func Sha256WithBase64(str string) string
|
||||
```
|
||||
|
||||
<b>实例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/85IXJHIal1k)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1262,7 +1274,7 @@ func main() {
|
||||
func Sha512(str string) string
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/3WsvLYZxsHa)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1293,7 +1305,7 @@ func main() {
|
||||
func Sha512WithBase64(str string) string
|
||||
```
|
||||
|
||||
<b>实例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/q_fY2rA-k5I)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1322,7 +1334,7 @@ func main() {
|
||||
func GenerateRsaKey(keySize int, priKeyFile, pubKeyFile string) error
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/zutRHrDqs0X)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1350,7 +1362,7 @@ func main() {
|
||||
func RsaEncrypt(data []byte, pubKeyFileName string) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/uef0q1fz53I)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1365,11 +1377,11 @@ func main() {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
data := []byte("hello")
|
||||
encrypted := cryptor.RsaEncrypt(data, "rsa_public.pem")
|
||||
decrypted := cryptor.RsaDecrypt(encrypted, "rsa_private.pem")
|
||||
|
||||
|
||||
fmt.Println(string(decrypted))
|
||||
|
||||
// Output:
|
||||
@@ -1377,7 +1389,6 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### <span id="RsaDecrypt">RsaDecrypt</span>
|
||||
|
||||
<p>用私钥文件rsa解密数据。</p>
|
||||
@@ -1388,7 +1399,7 @@ func main() {
|
||||
func RsaDecrypt(data []byte, privateKeyFileName string) []byte
|
||||
```
|
||||
|
||||
<b>示例:</b>
|
||||
<b>示例:<span class="run-container">[运行](https://go.dev/play/p/uef0q1fz53I)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1403,14 +1414,14 @@ func main() {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
data := []byte("hello")
|
||||
encrypted := cryptor.RsaEncrypt(data, "rsa_public.pem")
|
||||
decrypted := cryptor.RsaDecrypt(encrypted, "rsa_private.pem")
|
||||
|
||||
|
||||
fmt.Println(string(decrypted))
|
||||
|
||||
// Output:
|
||||
// hello
|
||||
}
|
||||
```
|
||||
```
|
||||
70
docs/en/api/overview.md
Normal file
70
docs/en/api/overview.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# API Overview
|
||||
|
||||
<b>Lancet (Lancet) is a powerful, comprehensive, efficient and reusable go language tool function library. Contains 25 packages, more than 600 utility functions. Functions cover string processing, slice processing, network, concurrency, encryption and decryption, file processing, time/date, stream processing, iterators, and more.</b>
|
||||
|
||||
|
||||
<style>
|
||||
.package-title {
|
||||
color: black;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
.package-container {
|
||||
font-size: 16px;
|
||||
border: 1px dashed;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.package-cell {
|
||||
height: 40px;
|
||||
width: 140px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
line-height: 40px;
|
||||
background: #ecefff;
|
||||
border: 1px solid;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
<p class="package-title">lancet function module</p>
|
||||
<div class="package-container">
|
||||
<div class="package-cell">algorithm</div>
|
||||
<div class="package-cell">compare</div>
|
||||
<div class="package-cell">concurrency</div>
|
||||
<div class="package-cell">condition</div>
|
||||
<div class="package-cell">convertor</div>
|
||||
<div class="package-cell">cryptor</div>
|
||||
<div class="package-cell">datastructure</div>
|
||||
<div class="package-cell">datetime</div>
|
||||
<div class="package-cell">fileutil</div>
|
||||
<div class="package-cell">formatter</div>
|
||||
<div class="package-cell">function</div>
|
||||
<div class="package-cell">iterator</div>
|
||||
<div class="package-cell">maputil</div>
|
||||
<div class="package-cell">mathutil</div>
|
||||
<div class="package-cell">netutil</div>
|
||||
<div class="package-cell">pointer</div>
|
||||
<div class="package-cell">random</div>
|
||||
<div class="package-cell">retry</div>
|
||||
<div class="package-cell">slice</div>
|
||||
<div class="package-cell">stream</div>
|
||||
<div class="package-cell">structs</div>
|
||||
<div class="package-cell">strutil</div>
|
||||
<div class="package-cell">system</div>
|
||||
<div class="package-cell">tuple</div>
|
||||
<div class="package-cell">validator</div>
|
||||
<div class="package-cell">xerror</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,8 @@ Package algorithm implements some basic algorithm. eg. sort, search.
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
@@ -51,7 +53,7 @@ import (
|
||||
func BubbleSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/GNdv7Jg2Taj)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -99,7 +101,7 @@ func main() {
|
||||
func InsertionSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/G5LJiWgJJW6)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -162,7 +164,7 @@ func main() {
|
||||
func SelectionSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/oXovbkekayS)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -210,7 +212,7 @@ func main() {
|
||||
func ShellSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/3ibkszpJEu3)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -258,7 +260,7 @@ func main() {
|
||||
func QuickSort[T any](slice []T comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/7Y7c1Elk3ax)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -306,7 +308,7 @@ func main() {
|
||||
func HeapSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/u6Iwa1VZS_f)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -354,7 +356,7 @@ func main() {
|
||||
func MergeSort[T any](slice []T, comparator lancetconstraints.Comparator)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/ydinn9YzUJn)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -402,7 +404,7 @@ func main() {
|
||||
func CountSort[T any](slice []T, comparator lancetconstraints.Comparator) []T
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/tB-Umgm0DrP)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -451,7 +453,7 @@ func main() {
|
||||
func BinarySearch[T any](sortedSlice []T, target T, lowIndex, highIndex int, comparator lancetconstraints.Comparator) int
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/t6MeGiUSN47)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -502,7 +504,7 @@ func main() {
|
||||
func BinaryIterativeSearch[T any](sortedSlice []T, target T, lowIndex, highIndex int, comparator lancetconstraints.Comparator) int
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/Anozfr8ZLH3)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -553,7 +555,7 @@ func main() {
|
||||
func LinearSearch[T any](slice []T, target T, equal func(a, b T) bool) int
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/IsS7rgn5s3x)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -596,7 +598,7 @@ func (l *LRUCache[K, V]) Delete(key K) bool
|
||||
func (l *LRUCache[K, V]) Len() int
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/IsS7rgn5s3x)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -34,13 +34,15 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## Documentation
|
||||
|
||||
### <span id="Equal">Equal</span>
|
||||
|
||||
<p>Checks if two values are equal or not. (check both type and value)</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/wmVxR-to4lz)</span></b>
|
||||
|
||||
```go
|
||||
func Equal(left, right any) bool
|
||||
@@ -89,7 +91,7 @@ func main() {
|
||||
|
||||
<p>Checks if two values are equal or not. (check value only)</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/fxnna_LLD9u)</span></b>
|
||||
|
||||
```go
|
||||
func EqualValue(left, right any) bool
|
||||
@@ -128,7 +130,7 @@ func main() {
|
||||
|
||||
<p>Checks if value `left` less than value `right`.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/cYh7FQQj0ne)</span></b>
|
||||
|
||||
```go
|
||||
func LessThan(left, right any) bool
|
||||
@@ -183,7 +185,7 @@ func main() {
|
||||
func GreaterThan(left, right any) bool
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/9-NYDFZmIMp)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -235,7 +237,7 @@ func main() {
|
||||
func LessOrEqual(left, right any) bool
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/e4T_scwoQzp)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -278,7 +280,7 @@ func main() {
|
||||
|
||||
<p>Checks if value `left` less greater or equal than value `right`.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/vx8mP0U8DFk)</span></b>
|
||||
|
||||
```go
|
||||
func GreaterOrEqual(left, right any) bool
|
||||
@@ -330,7 +332,7 @@ func main() {
|
||||
|
||||
<p>Checks if two values are equal or not within a delta.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/TuDdcNtMkjo)</span></b>
|
||||
|
||||
```go
|
||||
func InDelta[T constraints.Integer | constraints.Float](left, right T, delta float64) bool
|
||||
@@ -33,8 +33,9 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
## Documentation
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## Documentation
|
||||
|
||||
## Channel
|
||||
### <span id="NewChannel">NewChannel</span>
|
||||
@@ -46,7 +47,7 @@ import (
|
||||
type Channel[T any] struct
|
||||
func NewChannel[T any]() *Channel[T]
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/7aB4KyMMp9A)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -70,7 +71,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) Bridge(ctx context.Context, chanStream <-chan <-chan T) <-chan T
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/qmWSy1NVF-Y)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -122,7 +123,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) FanIn(ctx context.Context, channels ...<-chan T) <-chan T
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/2VYFMexEvTm)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -156,7 +157,7 @@ func main() {
|
||||
|
||||
<p>Create channel, put values into the channel repeatly until cancel the context.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/k5N_ALVmYjE)</span></b>
|
||||
|
||||
```go
|
||||
func (c *Channel[T]) Repeat(ctx context.Context, values ...T) <-chan T
|
||||
@@ -200,7 +201,7 @@ func main() {
|
||||
```go
|
||||
func (c *Channel[T]) Generate(ctx context.Context, values ...T) <-chan T
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example: <span class="run-container">[Run](https://go.dev/play/p/7aB4KyMMp9A)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -233,7 +234,7 @@ func main() {
|
||||
|
||||
<p>Create a channel, excutes fn repeatly, and put the result into the channel, until close context.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/4J1zAWttP85)</span></b>
|
||||
|
||||
```go
|
||||
func (c *Channel[T]) RepeatFn(ctx context.Context, fn func() T) <-chan T
|
||||
@@ -275,7 +276,7 @@ func main() {
|
||||
|
||||
<p>Read one or more channels into one channel, will close when any readin channel is closed.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/Wqz9rwioPww)</span></b>
|
||||
|
||||
```go
|
||||
func (c *Channel[T]) Or(channels ...<-chan T) <-chan T
|
||||
@@ -318,7 +319,7 @@ func main() {
|
||||
|
||||
<p>Read a channel into another channel, will close until cancel context.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/lm_GoS6aDjo)</span></b>
|
||||
|
||||
```go
|
||||
func (c *Channel[T]) OrDone(ctx context.Context, channel <-chan T) <-chan T
|
||||
@@ -356,7 +357,7 @@ func main() {
|
||||
|
||||
<p>Create a channel whose values are taken from another channel with limit number.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/9Utt-1pDr2J)</span></b>
|
||||
|
||||
```go
|
||||
func (c *Channel[T]) Take(ctx context.Context, valueStream <-chan T, number int) <-chan T
|
||||
@@ -402,7 +403,7 @@ func main() {
|
||||
|
||||
<p>Split one chanel into two channels, until cancel the context.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
<b>Signature: <span class="run-container">[Run](https://go.dev/play/p/3TQPKnCirrP)</span></b>
|
||||
|
||||
```go
|
||||
func (c *Channel[T]) Tee(ctx context.Context, in <-chan T) (<-chan T, <-chan T)
|
||||
@@ -31,6 +31,8 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
@@ -46,7 +48,7 @@ All other types are truthy if they are not their zero value.</p>
|
||||
```go
|
||||
func Bool[T any](value T) bool
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[运行](https://go.dev/play/p/ETzeDJRSvhm)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -111,7 +113,7 @@ func main() {
|
||||
```go
|
||||
func And[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[运行](https://go.dev/play/p/W1SSUmt6pvr)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -139,7 +141,7 @@ func main() {
|
||||
```go
|
||||
func Or[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[运行](https://go.dev/play/p/UlQTxHaeEkq)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -167,7 +169,7 @@ func main() {
|
||||
```go
|
||||
func Xor[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[运行](https://go.dev/play/p/gObZrW7ZbG8)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -195,7 +197,7 @@ func main() {
|
||||
```go
|
||||
func Nor[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[运行](https://go.dev/play/p/g2j08F_zZky)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -222,7 +224,7 @@ func main() {
|
||||
```go
|
||||
func Xnor[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[运行](https://go.dev/play/p/OuDB9g51643)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -249,7 +251,7 @@ func main() {
|
||||
```go
|
||||
func Nand[T, U any](a T, b U) bool
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[运行](https://go.dev/play/p/vSRMLxLIbq8)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -277,7 +279,7 @@ func main() {
|
||||
```go
|
||||
func TernaryOperator[T, U any](isTrue T, ifValue U, elseValue U) U
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[运行](https://go.dev/play/p/ElllPZY0guT)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -46,6 +46,8 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## Documentation
|
||||
|
||||
### <span id="ColorHexToRGB">ColorHexToRGB</span>
|
||||
@@ -58,7 +60,7 @@ import (
|
||||
func ColorHexToRGB(colorHex string) (red, green, blue int)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/o7_ft-JCJBV)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -89,7 +91,7 @@ func main() {
|
||||
func ColorRGBToHex(red, green, blue int) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/nzKS2Ro87J1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -122,7 +124,7 @@ func main() {
|
||||
func ToBool(s string) (bool, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/ARht2WnGdIN)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -163,7 +165,7 @@ func main() {
|
||||
func ToBytes(data any) ([]byte, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/fAMXYFDvOvr)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -196,7 +198,7 @@ func main() {
|
||||
func ToChar(s string) []string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/JJ1SvbFkVdM)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -232,7 +234,7 @@ func main() {
|
||||
func ToChannel[T any](array []T) <-chan T
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/hOx_oYZbAnL)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -269,7 +271,7 @@ func main() {
|
||||
func ToFloat(value any) (float64, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/4YTmPCibqHJ)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -314,7 +316,7 @@ func main() {
|
||||
func ToInt(value any) (int64, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/9_h9vIt-QZ_b)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -356,7 +358,7 @@ func main() {
|
||||
func ToJson(value any) (string, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/2rLIkMmXWvR)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -391,7 +393,7 @@ func main() {
|
||||
func ToMap[T any, K comparable, V any](array []T, iteratee func(T) (K, V)) map[K]V
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/tVFy7E-t24l)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -432,7 +434,7 @@ func main() {
|
||||
func ToPointer[T any](value T) *T
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/ASf_etHNlw1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -461,7 +463,7 @@ func main() {
|
||||
func ToString(value any) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/nF1zOOslpQq)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -509,7 +511,7 @@ func main() {
|
||||
func StructToMap(value any) (map[string]any, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/KYGYJqNUBOI)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -547,7 +549,7 @@ func main() {
|
||||
func MapToSlice[T any, K comparable, V any](aMap map[K]V, iteratee func(K, V) T) []T
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/dmX4Ix5V6Wl)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -577,7 +579,7 @@ func main() {
|
||||
func EncodeByte(data any) ([]byte, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/DVmM1G5JfuP)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -606,7 +608,7 @@ func main() {
|
||||
func DecodeByte(data []byte, target any) error
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/zI6xsmuQRbn)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -642,7 +644,7 @@ func main() {
|
||||
func DeepClone[T any](src T) T
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/j4DP5dquxnk)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -706,7 +708,7 @@ func main() {
|
||||
func CopyProperties[T, U any](dst T, src U) (err error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/oZujoB5Sgg5)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -785,7 +787,7 @@ func main() {
|
||||
func ToInterface(v reflect.Value) (value interface{}, ok bool)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/syqw0-WG7Xd)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -820,7 +822,7 @@ func main() {
|
||||
func Utf8ToGbk(bs []byte) ([]byte, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/9FlIaFLArIL)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -854,7 +856,7 @@ func main() {
|
||||
func GbkToUtf8(bs []byte) ([]byte, error)
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/OphmHCN_9u8)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -69,6 +69,8 @@ import (
|
||||
|
||||
<div STYLE="page-break-after: always;"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/styles/api_doc.css">
|
||||
|
||||
## Documentation
|
||||
|
||||
### <span id="AesEcbEncrypt">AesEcbEncrypt</span>
|
||||
@@ -80,7 +82,7 @@ import (
|
||||
```go
|
||||
func AesEcbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/zI6xsmuQRbn)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -113,7 +115,7 @@ func main() {
|
||||
```go
|
||||
func AesEcbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/zI6xsmuQRbn)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -146,7 +148,7 @@ func main() {
|
||||
```go
|
||||
func AesCbcEncrypt(data, key []byte) []byte
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/IOq_g8_lKZD)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -180,7 +182,7 @@ func main() {
|
||||
func AesCbcDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/IOq_g8_lKZD)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -214,7 +216,7 @@ func main() {
|
||||
func AesCtrCrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/SpaZO0-5Nsp)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -248,7 +250,7 @@ func main() {
|
||||
func AesCfbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/tfkF10B13kH)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -282,7 +284,7 @@ func main() {
|
||||
func AesCfbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/tfkF10B13kH)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -316,7 +318,7 @@ func main() {
|
||||
func AesOfbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/VtHxtkUj-3F)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -349,7 +351,7 @@ func main() {
|
||||
func AesOfbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/VtHxtkUj-3F)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -382,7 +384,7 @@ func main() {
|
||||
```go
|
||||
func Base64StdEncode(s string) string
|
||||
```
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/VOaUyQUreoK)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -410,7 +412,7 @@ func main() {
|
||||
func Base64StdDecode(s string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/RWQylnJVgIe)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -439,7 +441,7 @@ func main() {
|
||||
func DesEcbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/8qivmPeZy4P)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -473,7 +475,7 @@ func main() {
|
||||
func DesEcbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/8qivmPeZy4P)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -508,7 +510,7 @@ func main() {
|
||||
func DesCbcEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/4cC4QvWfe3_1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -542,7 +544,7 @@ func main() {
|
||||
func DesCbcDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/4cC4QvWfe3_1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -575,7 +577,7 @@ func main() {
|
||||
func DesCtrCrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/9-T6OjKpcdw)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -609,7 +611,7 @@ func main() {
|
||||
func DesCfbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/y-eNxcFBlxL)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -642,7 +644,7 @@ func main() {
|
||||
func DesCfbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/y-eNxcFBlxL)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -675,7 +677,7 @@ func main() {
|
||||
func DesOfbEncrypt(data, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/74KmNadjN1J)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -708,7 +710,7 @@ func main() {
|
||||
func DesOfbDecrypt(encrypted, key []byte) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/74KmNadjN1J)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -742,7 +744,7 @@ func main() {
|
||||
func HmacMd5(str, key string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/uef0q1fz53I)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -774,7 +776,7 @@ func main() {
|
||||
func HmacMd5WithBase64(str, key string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/UY0ng2AefFC)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -806,7 +808,7 @@ func main() {
|
||||
func HmacSha1(str, key string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/1UI4oQ4WXKM)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -838,7 +840,7 @@ func main() {
|
||||
func HmacSha1WithBase64(str, key string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/47JmmGrnF7B)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -870,7 +872,7 @@ func main() {
|
||||
func HmacSha256(str, key string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/HhpwXxFhhC0)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -902,7 +904,7 @@ func main() {
|
||||
func HmacSha256WithBase64(str, key string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/EKbkUvPTLwO)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -934,7 +936,7 @@ func main() {
|
||||
func HmacSha512(str, key string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/59Od6m4A0Ud)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -966,7 +968,7 @@ func main() {
|
||||
func HmacSha512WithBase64(str, key string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/c6dSe3E2ydU)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -999,7 +1001,7 @@ func main() {
|
||||
func Md5String(s string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/1bLcVetbTOI)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1030,7 +1032,7 @@ func main() {
|
||||
func Md5StringWithBase64(s string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/Tcb-Z7LN2ax)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1059,7 +1061,7 @@ func main() {
|
||||
func Md5Byte(data []byte) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/suraalH8lyC)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1088,7 +1090,7 @@ func main() {
|
||||
func Md5ByteWithBase64(data []byte) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/Lx4gH7Vdr5_y)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1143,7 +1145,7 @@ func main() {
|
||||
func Sha1(str string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/_m_uoD1deMT)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1174,7 +1176,7 @@ func main() {
|
||||
func Sha1WithBase64(str string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/fSyx-Gl2l2-)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1203,7 +1205,7 @@ func main() {
|
||||
func Sha256(str string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/tU9tfBMIAr1)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1234,7 +1236,7 @@ func main() {
|
||||
func Sha256WithBase64(str string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/85IXJHIal1k)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1263,7 +1265,7 @@ func main() {
|
||||
func Sha512(str string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/3WsvLYZxsHa)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1294,7 +1296,7 @@ func main() {
|
||||
func Sha512WithBase64(str string) string
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/q_fY2rA-k5I)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1323,7 +1325,7 @@ func main() {
|
||||
func GenerateRsaKey(keySize int, priKeyFile, pubKeyFile string) error
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/zutRHrDqs0X)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1351,7 +1353,7 @@ func main() {
|
||||
func RsaEncrypt(data []byte, pubKeyFileName string) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/uef0q1fz53I)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -1389,7 +1391,7 @@ func main() {
|
||||
func RsaDecrypt(data []byte, privateKeyFileName string) []byte
|
||||
```
|
||||
|
||||
<b>Example:</b>
|
||||
<b>Example:<span class="run-container">[Run](https://go.dev/play/p/uef0q1fz53I)</span></b>
|
||||
|
||||
```go
|
||||
package main
|
||||
50
docs/en/guide/getting_started.md
Normal file
50
docs/en/guide/getting_started.md
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# Installation
|
||||
|
||||
1. <b>For users who use go1.18 and above, it is recommended to install lancet v2.x.x. Cause in v2.x.x all functions was rewriten with generics of go1.18.</b>
|
||||
|
||||
```go
|
||||
go get github.com/duke-git/lancet/v2 // will install latest version of v2.x.x
|
||||
```
|
||||
|
||||
2. <b>For users who use version below go1.18, you should install v1.x.x. The latest of v1.x.x is v1.4.1. </b>
|
||||
|
||||
```go
|
||||
go get github.com/duke-git/lancet // below go1.18, install latest version of v1.x.x
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Lancet organizes the code into package structure, and you need to import the corresponding package name when use it. For example, if you use string-related functions, just import the strutil package like below:
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/strutil"
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
Here takes the string function `Reverse` (reverse order string) as an example, and the strutil package needs to be imported.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/duke-git/lancet/v2/strutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := "hello"
|
||||
rs := strutil.Reverse(s)
|
||||
fmt.Println(rs) //olleh
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## More
|
||||
|
||||
Check out the [APIs]([API](https://lancet.go.dev/api/overview.html)) for details.
|
||||
18
docs/en/guide/introduction.md
Normal file
18
docs/en/guide/introduction.md
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# What is lancet?
|
||||
|
||||
<b>Lancet is a powerful, efficient, and reusable util function library of go. Inspired by the java apache common package and lodash.js. </b>
|
||||
|
||||
|
||||
## Why lancet?
|
||||
|
||||
Lancet makes Go dev easier by taking the hassle out of working with concurrency, net, math, slice, string, etc.
|
||||
Lancet's utility methods are great for:
|
||||
|
||||
- Iterating slice and array.
|
||||
- Manipulating strings.
|
||||
- Work with net and http.
|
||||
- Other tools, eg. random, crypto, stream, retry, etc.
|
||||
43
docs/en/index.md
Normal file
43
docs/en/index.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
# https://vitepress.dev/reference/default-theme-home-page
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: "Lancet"
|
||||
text: "A powerful util function library of Go"
|
||||
tagline: Simple, powerful, and efficient.
|
||||
actions:
|
||||
- theme: brand
|
||||
text: Get Started
|
||||
link: /en/guide/getting_started
|
||||
- theme: alt
|
||||
text: View on GitHub
|
||||
link: https://github.com/duke-git/lancet
|
||||
# - theme: alt
|
||||
# text: API Examples
|
||||
# link: /api-examples
|
||||
image:
|
||||
src: /lancet_logo.png
|
||||
alt: lancet
|
||||
|
||||
features:
|
||||
- title: Powerful
|
||||
icon: 💪
|
||||
details: support 600+ go util functions. inclueds string, slice, datetime, net, crypto, concurrency, etc.
|
||||
- title: Modular by design
|
||||
icon: 🏗
|
||||
details: Each module is designed as a package with no coupling between modules.
|
||||
- title: Pure
|
||||
icon: 💅
|
||||
details: Only depends on two kinds of libraries, go standard library and golang.org/x.
|
||||
- title: Simple
|
||||
icon: 👏
|
||||
details: Well structure, test for every exported function.
|
||||
---
|
||||
|
||||
<p style="position:relative; top: -316px;left: 560px;">
|
||||
<img style="display: inline-block;margin-right:10px;" src="https://img.shields.io/github/stars/duke-git/lancet?style=social" alt="">
|
||||
|
||||
<img style="display: inline-block" src="https://img.shields.io/github/forks/duke-git/lancet?style=social" alt="">
|
||||
|
||||
</p>
|
||||
48
docs/guide/getting_started.md
Normal file
48
docs/guide/getting_started.md
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# 安装
|
||||
|
||||
1. <b>使用 go1.18 及以上版本的用户,建议安装 v2.x.x。 因为 v2.x.x 应用 go1.18 的泛型重写了大部分函数。</b>
|
||||
|
||||
```go
|
||||
go get github.com/duke-git/lancet/v2 // will install latest version of v2.x.x
|
||||
```
|
||||
|
||||
2. <b>使用 go1.18 以下版本的用户,必须安装 v1.x.x。目前最新的 v1 版本是 v1.4.1。</b>
|
||||
|
||||
```go
|
||||
go get github.com/duke-git/lancet // below go1.18, install latest version of v1.x.x
|
||||
```
|
||||
|
||||
## 用法
|
||||
|
||||
lancet 是以包的结构组织代码的,使用时需要导入相应的包名。例如:如果使用字符串相关函数,需要导入 strutil 包:
|
||||
|
||||
```go
|
||||
import "github.com/duke-git/lancet/v2/strutil"
|
||||
```
|
||||
|
||||
## 示例
|
||||
|
||||
此处以字符串工具函数 Reverse(逆序字符串)为例,需要导入 strutil 包:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/duke-git/lancet/v2/strutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := "hello"
|
||||
rs := strutil.Reverse(s)
|
||||
fmt.Println(rs) //olleh
|
||||
}
|
||||
```
|
||||
|
||||
## More
|
||||
|
||||
其他特性请参考[API](https://lancet.go.dev/api/overview.html).
|
||||
18
docs/guide/introduction.md
Normal file
18
docs/guide/introduction.md
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# lancet是什么?
|
||||
|
||||
<b>lancet(柳叶刀)是一个强大、全面、高效、可复用的go语言工具函数库。lancet受到了java apache common包和lodash.js的启发。 </b>
|
||||
|
||||
|
||||
## 为什么选择lancet?
|
||||
|
||||
Lancet 消除了处理并发、网络、数学、切片、字符串等的麻烦,使 Go 开发变得更容易。
|
||||
Lancet 的实用方法非常适合:
|
||||
|
||||
- 迭代切片和数组。
|
||||
- 操作字符串。
|
||||
- 处理网络和http请求。
|
||||
- 其他工具,例如。 随机、加密、流、重试等。
|
||||
45
docs/index.md
Normal file
45
docs/index.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
# https://vitepress.dev/reference/default-theme-home-page
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: 'Lancet'
|
||||
text: '一个强大的Go语言工具函数库'
|
||||
tagline: '简洁, 强大, 高效'
|
||||
actions:
|
||||
- theme: brand
|
||||
text: 开始使用
|
||||
link: /guide/getting_started
|
||||
- theme: alt
|
||||
text: 在GitHub中查看
|
||||
link: https://github.com/duke-git/lancet
|
||||
|
||||
image:
|
||||
src: /lancet_logo.png
|
||||
alt: lancet
|
||||
|
||||
features:
|
||||
- title: 全面
|
||||
icon: 💪
|
||||
details: 特性丰富,支持600+ go util函数。字符串、切片、日期时间、网络、加密、并发...
|
||||
- title: 模块化设计
|
||||
icon: 🏗
|
||||
details: 每个模块设计成一个包,模块之间无耦合。
|
||||
- title: 纯净
|
||||
icon: 💅
|
||||
details: 只依赖go标准库和golang.org/x。
|
||||
- title: 简洁
|
||||
icon: 👏
|
||||
details: 结构良好,测试每个导出的函数。
|
||||
---
|
||||
|
||||
<p style="position:relative; top: -316px;left: 540px;">
|
||||
<img style="display: inline-block;margin-right:10px;" src="https://img.shields.io/github/stars/duke-git/lancet?style=social" alt="">
|
||||
|
||||
<img style="display: inline-block" src="https://img.shields.io/github/forks/duke-git/lancet?style=social" alt="">
|
||||
|
||||
<!-- [](https://github.com/duke-git/lancet)
|
||||
|
||||
[](https://github.com/duke-git/lancet) -->
|
||||
|
||||
</p>
|
||||
BIN
docs/lancet_logo.png
Normal file
BIN
docs/lancet_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
docs/lancet_logo_mini.png
Normal file
BIN
docs/lancet_logo_mini.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
1277
docs/package-lock.json
generated
Normal file
1277
docs/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
13
docs/package.json
Normal file
13
docs/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "lancet-docs",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"docs:dev": "vitepress dev",
|
||||
"docs:build": "vitepress build",
|
||||
"docs:preview": "vitepress preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vitepress": "^1.0.0-rc.4"
|
||||
}
|
||||
}
|
||||
4
docs/styles/api_doc.css
Normal file
4
docs/styles/api_doc.css
Normal file
@@ -0,0 +1,4 @@
|
||||
.run-container {
|
||||
float: right;
|
||||
display: inline-block;
|
||||
}
|
||||
@@ -594,9 +594,11 @@ func WriteCsvFile(filepath string, records [][]string, append bool) error {
|
||||
// WriteStringToFile write string to target file.
|
||||
// Play: https://go.dev/play/p/GhLS6d8lH_g
|
||||
func WriteStringToFile(filepath string, content string, append bool) error {
|
||||
flag := os.O_RDWR | os.O_CREATE
|
||||
var flag int
|
||||
if append {
|
||||
flag = flag | os.O_APPEND
|
||||
flag = os.O_RDWR | os.O_CREATE | os.O_APPEND
|
||||
} else {
|
||||
flag = os.O_RDWR | os.O_CREATE | os.O_TRUNC
|
||||
}
|
||||
|
||||
f, err := os.OpenFile(filepath, flag, 0644)
|
||||
|
||||
@@ -393,9 +393,7 @@ func TestWriteStringToFile(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
defer file.Close()
|
||||
|
||||
err = WriteStringToFile(filepath, "hello", false)
|
||||
err = WriteStringToFile(filepath, "hello world", false)
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
@@ -405,20 +403,32 @@ func TestWriteStringToFile(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
err = WriteStringToFile(filepath, "hello", false)
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
content2, err := ReadFileToString(filepath)
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
err = WriteStringToFile(filepath, " world", true)
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
content2, err := os.ReadFile(filepath)
|
||||
content3, err := os.ReadFile(filepath)
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
assert.Equal("hello", content1)
|
||||
assert.Equal("hello world", string(content2))
|
||||
assert.Equal("hello world", content1)
|
||||
assert.Equal("hello", content2)
|
||||
assert.Equal("hello world", string(content3))
|
||||
|
||||
os.Remove(filepath)
|
||||
_ = file.Close()
|
||||
_ = os.Remove(filepath)
|
||||
}
|
||||
|
||||
func TestWriteBytesToFile(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user