tools

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 19 Imported by: 0

README

Go Report Card GoDoc GolangCI

xmodules/tools for Xamboo - GO

The tools package give some standard functions

  • UUID() string,
  • MD5(string)string,
  • CreateKey(length, type) string
  • Messages selection for modules with languages

Version Changes Control

v0.0.1 - 2021-01-15

  • Add language support for message selection

v0.0.0 - 2020-04-20

  • First release

Manual:

I. Tools

Intro


  1. Overview

Example:

import "github.com/webability-go/xmodules/tools"


  1. Reference

To use the package:

import "github.com/webability-go/xmodules/tools"

Documentation

Index

Constants

This section is empty.

Variables

Language is the default system language to search messages in this language in priority It may be changed by the code at anytime. Recommended to change it to your language when you init your libraries

Functions

func BuildConfigSet

func BuildConfigSet(config *xconfig.XConfig) xcore.XDataset

func BuildMessages

func BuildMessages(data map[language.Tag]map[string]string) *map[language.Tag]*xcore.XLanguage

func BuildMessagesFS added in v0.0.16

func BuildMessagesFS(fs embed.FS, path string) *map[language.Tag]*xcore.XLanguage

func CreateDirectoryObject added in v0.0.16

func CreateDirectoryObject(clave, nivel int, prefix string) (string, error)

CreateDirectoryObject crea directorio objeto retornar prefix + "/" + dirnivel

func CreateKey

func CreateKey(length int, chartype int) string

Creates a string of random chars and digits of length

chartype = -1: lowers, uppers and digits
chartype = 0: only digits
chartype = 1 only uppers
chartype = 2 only lowers

func FileGetContents added in v0.0.16

func FileGetContents(filename string) (string, error)

func FilePutContents added in v0.0.16

func FilePutContents(path, filename string, content string) error

FilePutContents : create the file if not exist and put a new line

func GetMD5Hash

func GetMD5Hash(text string) string

func ImageDownload added in v0.0.16

func ImageDownload(url, path, name string) (string, error)

ImageDownload : Receive the url for get the image and the path of the folder target

func LogMessage added in v0.0.16

func LogMessage(log *log.Logger, lang *xcore.XLanguage, id string, params ...interface{}) string

func Message

func Message(messages *map[language.Tag]*xcore.XLanguage, id string, params ...interface{}) string

func MoveFile added in v0.0.16

func MoveFile(sourcePath, names, destPath, named string, deleteold bool) error

MoveFile : copy the file fron source path to destiny dir, it is possible delete the file from the source dir

func UUID

func UUID() string

func WajafLogErrorMessage added in v0.0.16

func WajafLogErrorMessage(log *log.Logger, lang *xcore.XLanguage, id string, params ...interface{}) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL