encode

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package encode facilitates encoding data based on struct tags to simplify development. It currently supports querying documents based on xpath from struct tags and building url params from structs. If a field is unset the default behaviour of all functions is to skip it, contrary to what other packages like json do by using the struct field name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetXpathLinks(node *html.Node) types.Links

Returns a list of Link by searching for all a tags.

func URLMapParams

func URLMapParams(params map[string]any, existingValues url.Values) url.Values

Function to encode a map into URL parameters.

func URLParams

func URLParams(params interface{}) (url.Values, error)

URLParams function to encode struct fields into URL parameters

func Xpath

func Xpath(doc *html.Node, target any) error

Function to scrape any html document with xpath provided in struct tags:

- doc *html.Node : The base document or node at which all queries start.

- val interface : input data type.

See https://github.com/Jisin/filmigo/xpath for examples and full reference.

Types

This section is empty.

Jump to

Keyboard shortcuts

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