This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package validator | |
import ( | |
"errors" | |
"reflect" | |
"strings" | |
"github.com/gin-gonic/gin/binding" | |
"github.com/go-playground/locales/zh" | |
ut "github.com/go-playground/universal-translator" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package response | |
import ( | |
"errors" | |
"net/http" | |
"exceptions" | |
"github.com/gin-gonic/gin" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exceptions | |
import ( | |
"errors" | |
"net/http" | |
) | |
const separator = 1000 | |
var ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package casbin | |
import ( | |
"errors" | |
"net/http" | |
"strconv" | |
"strings" | |
"github.com/casbin/casbin/v2" | |
gormadapter "github.com/casbin/gorm-adapter/v3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package querybuilder | |
import ( | |
"context" | |
"fmt" | |
"gorm.io/gorm" | |
) | |
// use: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sort = unsorted => Object.keys(unsorted).sort().reduce((result, key) => (result[key] = unsorted[key], result), {}); | |
const flatten = list => Object.keys(list).reduce((result, key) => result.concat(list[key]), []); | |
const groupBy = (arr, key) => arr.reduce((result, item) => ((result[item[key]] = result[item[key]] || []).push(item), result), {}); | |
const only = (arr, keys) => arr.map(item => keys.filter(key => key in item).reduce((result, key) => (result[key] = item[key], result), {})); | |
const fuzzy = (data, key) => data[Object.keys(data).find(element => element.includes(key))]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Tap class | |
* | |
* @author WmKong<im.wmkong@gmail.com> | |
*/ | |
class Tap | |
{ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Collection class | |
* | |
* @author WmKong<im.wmkong@gmail.com> | |
*/ | |
class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable, Serializable | |
{ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ArrayStore class | |
* | |
* @author WmKong <im.wmkong@gmail.com> | |
*/ | |
class ArrayStore implements ArrayAccess | |
{ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Redis 分布式锁 | |
* | |
* @author WmKong <im.wmkong@gmail.com> | |
*/ | |
class Lock | |
{ | |
/** |
NewerOlder