linkdb

package
v0.0.0-...-c0e28cb Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FilterKindExact = "exact"
	FilterKindAny   = "any"
)

Variables

This section is empty.

Functions

func GenerateError

func GenerateError(errorCode string, errorFunction string, errorInfo string) []byte

GenerateError - generate error response

func InitDB

func InitDB(connectionString string) (*mongo.Client, error)

func InitRoutes

func InitRoutes(app *App) *mux.Router

func InitServer

func InitServer(host string, port string, dbname string)

func SendResponse

func SendResponse(w http.ResponseWriter, status int, data []byte)

SendResponse - send http response

Types

type APIRequest

type APIRequest struct {
	Domain  *string             `json:"domain,omitempty"`
	Limit   *int64              `json:"limit,omitempty"`
	Sort    *string             `json:"sort,omitempty"`
	Order   *string             `json:"order,omitempty"`
	Page    *int64              `json:"page,omitempty"`
	Filters *[]ApiRequestFilter `json:"filters,omitempty"`
}

type ApiError

type ApiError struct {
	ErrorCode string `json:"errorCode"`
	Function  string `json:"function"`
	Error     string `json:"error"`
}

type ApiRequestFilter

type ApiRequestFilter struct {
	Name string `json:"name"`
	Val  string `json:"val"`
	Kind string `json:"kind"`
}

type App

type App struct {
	DB     *mongo.Client
	Dbname string
	// contains filtered or unexported fields
}
func (app *App) ControllerGetDomainLinks(apiRequest APIRequest) ([]LinkOut, error)
func (app *App) HandlerGetDomainLinks(w http.ResponseWriter, r *http.Request)

HandlerGetDomainLinks - get domain links

func (*App) LinkdbApiRoutes

func (app *App) LinkdbApiRoutes(router *mux.Router) *mux.Router

type LinkOut

type LinkOut struct {
	LinkUrl  string   `json:"link_url"`
	PageUrl  string   `json:"page_url"`
	LinkText string   `json:"link_text"`
	NoFollow int      `json:"no_follow"`
	NoIndex  int      `json:"no_index"`
	DateFrom string   `json:"date_from"`
	DateTo   string   `json:"date_to"`
	IP       []string `json:"ip"`
	Qty      int      `json:"qty"`
}

LinkOut - link output

type LinkRow

type LinkRow struct {
	LinkDomain    string `json:"link_domain"`
	LinkSubDomain string `json:"link_sub_domain"`
	LinkPath      string `json:"link_path"`
	LinkRawQuery  string `json:"link_raw_query"`
	LinkScheme    string `json:"link_scheme"`
	PageHost      string `json:"page_host"`
	PagePath      string `json:"page_path"`
	PageRawQuery  string `json:"page_raw_query"`
	PageScheme    string `json:"page_scheme"`
	LinkText      string `json:"link_text"`
	NoFollow      int    `json:"no_follow"`
	NoIndex       int    `json:"no_index"`
	DateFrom      string `json:"date_from"`
	DateTo        string `json:"date_to"`
	IP            string `json:"ip"`
	Qty           int    `json:"qty"`
}

LinkRow - link row

type RequestInfo

type RequestInfo struct {
	FirstRequestTime time.Time
	RequestCount     int
}

RequestInfo - request info used to count requests in a period of time

Jump to

Keyboard shortcuts

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