{"modulePath":"github.com/AlaudaDevops/pkg","version":"v0.14.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package common\n\nPackage common useful functionality for encoding and decoding objects\n\n## Constants\n\n```go\nconst (\n\t// Default number of pages\n\tDefaultPerPage = 20\n\n\t// Default page number\n\tDefaultPage = 1\n)\n```\n\n## Functions\n\n```go\nfunc Contains[T comparable](collection []T, element T) bool\n```\nContains returns true if an element is present in a collection. Deprecated: use \\`slice.Contains\\` which import from \\`golang.org/x/exp/slices\\` instead\n\n```go\nfunc FromJSONBase64(encodeStr string, obj interface{}) error\n```\nFromJSONBase64 decode encodeStr using base64, and then use json to convert to obj. Deprecated: use encoding.Base64Decode instead\n\n```go\nfunc Paginate(total, perPage, page int) (begin, end int)\n```\nPaginate this function implements the paging of List, inputting the total number of data (usually the length of Slice), the number of each page, and the page number. The function guarantees that Begin and End do not exceed the total number of data.\n\nIf input perPage is less than 1, it will be set as DefaultPerPage. If input page is less than 1, it will be set as DefaultPage.\n\nReturns the start and end position of the pagination.\n\n```go\nfunc ToJSONBase64(obj interface{}) (string, error)\n```\nToJSONBase64 convert obj to json string, and then encode it with base64. Deprecated: use encoding.Base64Encode instead\n\n","path":"github.com/AlaudaDevops/pkg/common","name":"common","synopsis":"Package common useful functionality for encoding and decoding objects","isRedistributable":true}
