models

package
v0.0.0-...-6d375a0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PageData

type PageData struct {
	URL             string   `json:"url,omitempty"`
	MatchingTerms   []string `json:"matching_terms,omitempty"`
	SimilarityScore float64  `json:"similarity_score,omitempty"`
	Error           string   `json:"error,omitempty"`
}

PageData represents the data of a crawled page.

func (*PageData) MarshalBinary

func (p *PageData) MarshalBinary() ([]byte, error)

MarshalBinary marshals the PageData into binary form. It returns an error if the PageData is not valid or if the marshaling fails.

func (*PageData) UnmarshalBinary

func (p *PageData) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshals binary data into PageData. It returns an error if the unmarshaling fails or if the PageData is not valid after unmarshaling.

func (*PageData) UpdatePageData

func (p *PageData) UpdatePageData(matchingTerms []string, similarityScore float64)

UpdatePageData updates the PageData with the matching terms, and similarity score. It sets the MatchingTerms and SimilarityScore fields of the PageData.

func (*PageData) Validate

func (p *PageData) Validate() error

Validate checks if the PageData fields are valid. It returns an error if the URL field is not a valid URL.

Jump to

Keyboard shortcuts

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