Documentation
¶
Index ¶
- Constants
- Variables
- func AnsiCompareText(str1, str2 string) int
- func AnsiQuotedStr(S string, Quote byte) string
- func ByteToGzipByte(data []byte, filename string) ([]byte, error)
- func ByteToSaveFile(nomeArquivo string, dados []byte) error
- func CloneBytes(src []byte) []byte
- func ConvertToStringPointers(input []string) []*string
- func Copy(value string, colIni, qtdeCaracteres int) string
- func DateNilToStr(date *time.Time) string
- func DateToStr(date time.Time) string
- func DecompressGzipToBytes(gzippedData []byte) ([]byte, error)
- func DecompressGzipToSaveOneFile(gzippedData []byte, outputPath string) error
- func DecryptData(privateKey *rsa.PrivateKey, encryptedData []byte) ([]byte, error)
- func Dividir(numerador, denominador float64) float64
- func EncodeByte(input []byte) string
- func EncodeString(input string) string
- func EncryptData(publicKey *rsa.PublicKey, data []byte) ([]byte, error)
- func EndDayOfYearMonth(year int, month time.Month) time.Time
- func Espacos(quantidade int) string
- func Exclude[T comparable](slice []T, value T) []T
- func ExtractFileNameWithoutExt(fileName string) string
- func FileExists(filePath string) bool
- func FileToGzipFile(nomeArquivo, nomedozip string) error
- func FloatToInt(value float64) int
- func FloatToStr(value float64, width, precision int) string
- func FloatToStrPTBR(value float64, width, precision int) string
- func FormatCPF(cpf string) string
- func FormatDate(format string, date time.Time) string
- func FormatDatePoint(format string, date *time.Time) *string
- func FormatDecimal(value string) string
- func FormatFloat(format string, value float64, width, precision int) string
- func FormatMatrixFloat(numero float64, digitos, deci int) string
- func GenerateDeleteQuery(name string, id string) string
- func GenerateInsertQueryTagDb(name string, data interface{}) string
- func GenerateInsertQueryTagJson(name string, data interface{}) string
- func GenerateUpdateQueryTagDb(name string, data interface{}, id string) string
- func GenerateUpdateQueryTagJson(name string, data interface{}, id string) string
- func GerarQrCodeJpegBase64(pixCode string) string
- func GetApplicationName() string
- func GetApplicationNameExe() string
- func GetComputerName() string
- func GetEnvBool(value string) bool
- func GetEnvInt(value string) int
- func GetEnvString(value string) string
- func GetModuleName() string
- func GetPathApplication() string
- func GetPathApplicationFile(fileName string) string
- func Guid() uuid.UUID
- func GuidString() string
- func GzipCompress(data []byte) ([]byte, error)
- func GzipDecompress(compressedData []byte) (string, error)
- func IfThen[T any](condition bool, v1 T, v2 T) T
- func In[T any](valor T, lista []T) bool
- func InIn[T any](lista1 []T, lista2 []T) bool
- func Include[T comparable](slice []T, value T) []T
- func Int64ToStr(value int64) string
- func IntToStr(value int) string
- func IsPointer(value interface{}) bool
- func IsQuotedBase(value string, ACh1, ACh2 byte) bool
- func IsValidEmail(email string) bool
- func JoinErrors(errors []error) string
- func LimitStr(value string, limit int) string
- func LoadPrivateKey(path string) (*rsa.PrivateKey, error)
- func LoadPublicKey(path string) (*rsa.PublicKey, error)
- func Lpad(s string, length int, padChar string) string
- func Md5(src string) string
- func OnlyAlfa(s string) string
- func OnlyAlfaNumber(s string) string
- func OnlyEmail(email string) string
- func OnlyNumber(s string) string
- func Pos(substring, s string) int
- func PreencherDireita(s string, tamanho int, caracter string) string
- func PreencherEsquerda(s string, tamanho int, caracter string) string
- func QuotedStr(s string) string
- func RandomString(qtde int) string
- func ReadJsonFileToStruct(PahtFile string, value any) error
- func RemoveAcentos(s string) string
- func RemoveCaracteres(texto string, pRemoveAcentos bool) string
- func RemoveFileExtension(name string) string
- func RemoverQuebraLinha(texto string) string
- func RepetirString(c string, quantidade int) string
- func Rpad(s string, length int, padChar string) string
- func SignData(privateKey *rsa.PrivateKey, data []byte) ([]byte, error)
- func StrIso8601ToDate1(str string) time.Time
- func StrIso8601ToDate2(str string) time.Time
- func StrToDate(str string) (time.Time, error)
- func StrToInt(value string) int
- func StrToInt64(value string) int64
- func Trim(value string) string
- func UnQuoteBase(value string, ACh1, ACh2 byte) string
- type Log
- func (lg *Log) Critical(app string, v ...interface{})
- func (lg *Log) Debug(app string, v ...interface{})
- func (lg *Log) Error(app string, v ...interface{})
- func (lg *Log) Fatal(app string, v ...interface{})
- func (lg *Log) Info(app string, v ...interface{})
- func (lg *Log) Print(msg ...interface{})
- func (lg *Log) Screen(app string, v ...interface{})
- func (lg *Log) Warning(app string, v ...interface{})
- func (lg *Log) WriteLog(app string, setTime bool, msg ...interface{})
- type LogEmp
- type Logger
- type MFile
- type NivelLog
- type TypePrint
Constants ¶
const ( Space = " " EmptyStr = "" LineBreak = "\n" )
const ( // LEVEL_DEBUG = 0 LEVEL_DEBUG = iota // LEVEL_INFO = 1 LEVEL_INFO // LEVEL_WARNING = 2 LEVEL_WARNING // LEVEL_ERROR = 3 LEVEL_ERROR // LEVEL_CRITICAL = 4 LEVEL_CRITICAL )
const Format1 = "2006-01-02T15:04:05"
const Format2 = "2006-01-02T15:04:05.000" //2025-02-30T00:00:00.000
Variables ¶
var ( // ErrInvalidLogLevel is used when an invalid log level has been used. ErrInvalidLogLevel = errors.New("invalid log level") )
Functions ¶
func AnsiCompareText ¶
func AnsiQuotedStr ¶
func ByteToGzipByte ¶ added in v1.0.154
ByteToGzipByte Esta funcao faz: 1 - pega um []byte coloca um nome nele 2 - Comprime ele em .gz e retorna o []byte (dele em gz) Ele faz tudo isso em memoria sem gerar arquivo em disco Otimo para enviar via http, ftp, etc
func ByteToSaveFile ¶
ByteToSaveFile: Converte Byte para Arquivo
func CloneBytes ¶
CloneBytes: copia o byte para evitar referencia cruzada de objetos
func ConvertToStringPointers ¶
func DateNilToStr ¶
DateNilToStr: Converte data em string dd/mm/yyyy
func DecompressGzipToBytes ¶ added in v1.0.154
DecompressGzipToBytes Esta funcao faz: 1 - pega um []byte coloca um nome nele 2 - Comprime ele de .gz para file e devolve o byte dele assim voce pode optar por salvar em disco ou ate salvar em banco 3 - retorna apenas o byte de um unico arquivo!
func DecompressGzipToSaveOneFile ¶ added in v1.0.154
DecompressGzipToSaveOneFile Esta funcao faz: 1 - pega um []byte coloca um nome nele 2 - Comprime ele de .gz para file e salva em um diretorio o arquivo (unico)
func DecryptData ¶
func DecryptData(privateKey *rsa.PrivateKey, encryptedData []byte) ([]byte, error)
Função para descriptografar dados com a chave privada RSA
func EncodeByte ¶
EncodeByte: Recebe uma []byte como entrada e retorna a string codificada em base64 Imita funcao da unit Soap.EncdDecd do Delphi
func EncodeString ¶
EncodeString: Recebe uma string como entrada e retorna a string codificada em base64 Imita funcao da unit Soap.EncdDecd do Delphi
func EncryptData ¶
Função para criptografar dados com a chave pública RSA
func EndDayOfYearMonth ¶
EndDayOfYearMonth: Ultimo dia do Ano/Mes , exemp: 2024/12 = dia é 31
func Exclude ¶
func Exclude[T comparable](slice []T, value T) []T
func FileToGzipFile ¶ added in v1.0.154
FileToGzipFile Comprime um arquivo em disco para um arquivo gzip
func FloatToStr ¶
func FormatDatePoint ¶
FormatDatePoint: Formata ponteiro de data
func FormatDecimal ¶
func FormatFloat ¶
FormatFloat: Exp:
comum.FormatFloat("%%%d.%df", mes.Valor, 4, 2)
comum.FormatFloat("%%%d.2f", item.Qtde_venda, 14, 2)
comum.FormatFloat("%%%d.2f", item.Qtde_venda, 14, 2)
func FormatMatrixFloat ¶
FormatMatrixFloat: FormatMatrixFloat(numero, 12, 2) = +000000051.01 FormatMatrixFloat(numero, 15, 3) = +00000000051.010
func GenerateDeleteQuery ¶
func GerarQrCodeJpegBase64 ¶
func GetApplicationName ¶
func GetApplicationName() string
GetApplicationName: nome da aplicação sem extensão
func GetApplicationNameExe ¶
func GetApplicationNameExe() string
GetApplicationNameExe: nome da aplicação com extensão
func GetComputerName ¶
func GetComputerName() string
GetApplicationName: nome da aplicação sem extensão
func GetModuleName ¶
func GetModuleName() string
func GetPathApplicationFile ¶
GetPathApplicationFile: Aplica pasta local da aplicação ao nome do arquivo informado
func GzipCompress ¶ added in v1.0.154
Função para compactar uma string usando GZIP
func GzipDecompress ¶ added in v1.0.154
Função para descompactar um GZIP para string
func InIn ¶
InIn: Procura valores de uma lista dentor de outra lista Encontrando qualquer valor ele retorna true
func Include ¶
func Include[T comparable](slice []T, value T) []T
Include adds a given value to a slice, if it doesn't already exist.
func IsQuotedBase ¶
func JoinErrors ¶
JoinErrors: Junta uma lista de erros e converte em string
func LoadPrivateKey ¶
func LoadPrivateKey(path string) (*rsa.PrivateKey, error)
Função para carregar a chave privada a partir de um arquivo PEM
func LoadPublicKey ¶
Função para carregar a chave pública a partir de um arquivo PEM
func OnlyAlfaNumber ¶
OnlyAlfaNumber: Deixa apenas Number/Alfa passar
func Pos ¶
Pos: Esta função Pos aceita dois argumentos: a substring que você está procurando e a string na qual você está procurando. Ela retorna o índice baseado em 1 da primeira ocorrência da substring na string. Se a substring não for encontrada, ela retorna 0 Comentario:
por mais que exista strings.Contains essa aqui retorna posicao onde encontrou o dado
caso de uso:
use para recortar um dado apos encontrar um dados desejado encontrar marcadores como <> ,</> para recortar dados
func PreencherDireita ¶
PreencherDireita: Preenche a direita com o caracter informado, caso exceda o tamanho informado ele recorta o valor
func PreencherEsquerda ¶
PreencherEsquerda: Preenche a esqueda com o caracter informado, caso exceda o tamanho informado ele recorta o valor
func RandomString ¶
func ReadJsonFileToStruct ¶
func RemoveCaracteres ¶
RemoveCaracteres: Remove tudo que não é letra, numero, ou espaco, pode remover acentos tambem caso[pRemoveAcentos]=(true)
func RemoveFileExtension ¶
RemoveFileExtension: Remove Extensão do arquivo
func RemoverQuebraLinha ¶
RemoverQuebraLinha: Função para remover quebras de linha \r ou \n
func RepetirString ¶
RepetirString: Repete uma string x vezes
func SignData ¶
func SignData(privateKey *rsa.PrivateKey, data []byte) ([]byte, error)
Função para assinar dados com a chave privada do remetente
func StrIso8601ToDate1 ¶
func StrIso8601ToDate2 ¶
func UnQuoteBase ¶
Types ¶
type Log ¶
type Logger ¶
type Logger interface {
Debug(v ...interface{})
Info(v ...interface{})
Warning(v ...interface{})
Error(v ...interface{})
Critical(v ...interface{})
Fatal(v ...interface{})
}
Logger collects logging information at several levels
type MFile ¶
func ListarArquivosPastaFiltro ¶
ListarArquivosPastaFiltro: Lista arquivos de uma pasta, porem voce pode filtrar por tipo de arquivos e tambem colocar um prefixo de procura exemplo: ListarArquivosPastaFiltro("c:\", "VRIN*", ".txt")
func ListarArquivosPastaTodos ¶
ListarArquivosPastaTodos: Lista arquivos de uma pasta informada