types

package
v0.0.0-...-5c34b2d Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DomainFrom

func DomainFrom(urlStr string) string

func GetHashIDs

func GetHashIDs[T HasHash](x []T) []string

Helper function to extract IDs from links

func Hash256

func Hash256(data string) string

func SafeUrlParser

func SafeUrlParser(url string) (string, error)

func URLToPathSlug

func URLToPathSlug(raw string) string

URLToPathSlug returns the path part of a URL (without leading/trailing slashes). If input is already a path like "/tag/slug-here/" or "slug-here", it normalizes and returns it.

Types

type HasHash

type HasHash interface {
	HashID() string
}
type Link struct {
	Hash         string `json:"hash" gorm:"unique"`
	Domain       string `json:"domain"`
	SitemapIndex string `json:"sitemap_index"`
	Url          string `json:"url"`
}
func NewLink(url string) *Link

func NewLinksFromSitemapIndex

func NewLinksFromSitemapIndex(urls []string) []Link

func (Link) HashID

func (link Link) HashID() string

type Site

type Site struct {
	Domain    string `json:"domain" gorm:"unique"`
	Url       string `json:"url"`
	Sitemaps  string `json:"sitemaps" gorm:"type:text"` //sitemap indexs
	CreatedAt int64  `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt int64  `json:"updated_at" gorm:"autoUpdateTime"`
}

func NewSite

func NewSite(url string) *Site

func (*Site) ParseSitemaps

func (s *Site) ParseSitemaps() []string

func (*Site) SetSitemaps

func (s *Site) SetSitemaps(sitemaps []string) *Site

type SitemapIndex

type SitemapIndex struct {
	Hash    string `json:"hash" gorm:"unique"`
	Domain  string `json:"domain"`
	Url     string `json:"url"`
	Scanned bool   `json:"scanned"`
}

func NewSitemapIndex

func NewSitemapIndex(url string) *SitemapIndex

func NewSitemapIndexsFrom

func NewSitemapIndexsFrom(site *Site) []SitemapIndex

func (SitemapIndex) HashID

func (s SitemapIndex) HashID() string

Jump to

Keyboard shortcuts

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