utils

package module
v0.0.0-...-02b2fdf Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 8 Imported by: 4

README

utils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToStruct

func ConvertToStruct(input interface{}, output interface{}) error

ConvertToStruct copies the input map to the output struct.

func ExtractValidationRules

func ExtractValidationRules(input interface{}) map[string]string

ExtractValidationRules extracts validation rules from the given input struct. It iterates over the fields of the struct and checks for the presence of "json" and "validate" tags. If a "json" tag is found, it maps the tag value to the corresponding "validate" tag value in the result map. If a field is of type struct, it recursively calls ExtractValidationRules to extract validation rules from the nested struct fields. The extracted validation rules are returned as a map[string]string, where the key represents the "json" tag value and the value represents the "validate" tag value.

func NewValidator

func NewValidator() *validate.Validate

NewValidator creates a new instance of the validator.Validate struct. It registers a custom validation functions for different types.

func RenderInputTemplate

func RenderInputTemplate(input string, t *types.Task, otherTasks []*types.Task) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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