utils

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TenderCodeRegex = regexp.MustCompile(`\d{4}-[A-Z0-9]+-[A-Z0-9]+`)

Functions

func EncryptByRSA added in v1.4.1

func EncryptByRSA(value string) (string, error)

headerValue := fmt.Sprintf("%s%s$$%d", baseURL, endpoint, time.Now().UnixMilli()) encryptedHeader, err := encryptByRSA(headerValue) if err != nil { return fmt.Errorf("encryption error: %w", err) }

// Create new request url := baseURL + endpoint + data req, err := http.NewRequest("GET", url, nil) if err != nil { return fmt.Errorf("failed to create request: %w", err) }

// Set headers req.Header.Set("nsssjss", encryptedHeader) req.Header.Set("Content-Type", "application/json; charset=utf-8")

func EscapeMarkdown

func EscapeMarkdown(s string) string

EscapeMarkdown In all other places characters '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!' must be escaped with the preceding character '\'. In all other places characters '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!' must be escaped with the preceding character '\'.

func NewTablePlugin added in v1.4.3

func NewTablePlugin() converter.Plugin

func SimplifyContent added in v1.4.2

func SimplifyContent(content string) string

func SimplifyHTML added in v1.4.1

func SimplifyHTML(content string) string

func ToString

func ToString(data interface{}) string

Types

type Config

type Config struct {
	// Enable console logging
	ConsoleLoggingEnabled bool

	// EncodeLogsAsJson makes the log framework log JSON
	EncodeLogsAsJson bool
	// FileLoggingEnabled makes the framework log to a file
	// the fields below can be skipped if this value is false!
	FileLoggingEnabled bool
	// Directory to log to when file logging is enabled
	Directory string
	// Filename is the name of the logfile which will be placed inside the directory
	Filename string
	// MaxSize the max size in MB of the logfile before it's rolled
	MaxSize int
	// MaxBackups the max number of rolled files to keep
	MaxBackups int
	// MaxAge the max age in days to keep a logfile
	MaxAge   int
	LogLevel zerolog.Level
}

Config for logging

type Logger

type Logger struct {
	*zerolog.Logger
}

func Configure

func Configure(config Config) *Logger

type TablePlugin added in v1.4.3

type TablePlugin struct{}

func (*TablePlugin) Init added in v1.4.3

func (p *TablePlugin) Init(conv *converter.Converter) error

func (*TablePlugin) Name added in v1.4.3

func (p *TablePlugin) Name() string

Jump to

Keyboard shortcuts

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