msg

package
v0.0.0-...-217dc0b Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HeadingIsh *regexp.Regexp = regexp.MustCompile(`(?:^|\<\/p\>)\s*([\w\d\/\s]+)(?:<p>)`)

HeadingIsh type regexp for abstracts Not elegant but it works

Functions

func NATServer

func NATServer() *server.Server

NATServer get reference to NATS server

func QueryNATS

func QueryNATS(search string, next int, isInCloud bool) ([]byte, error)

QueryNATS query a nats server

func ToHTML

func ToHTML(rs *ResultSet, isErr bool) (string, error)

ToHTML process template to HTML

Types

type Payload

type Payload struct {
	// contains filtered or unexported fields
}

Payload a payload to send back to browser

func NewPayload

func NewPayload() *Payload

NewPayload get a new result instance

type Query

type Query struct {
	SearchTerm string
	Next       int
}

Query a query

func NewQuery

func NewQuery(searchTerm string, next int) *Query

NewQuery make a new query

type Response

type Response struct {
	ResultSet *ResultSet `json:"response"`
}

Response corresponds to JSON fetched

type Result

type Result struct {
	ID              string   `json:"id"`
	Title           string   `json:"title"`
	Abstract        []string `json:"abstract_primary_display"`
	Journal         string   `json:"journal"`
	Author          []string `json:"author"`
	SearchTerm      string   `json:"searchTerm"`
	Message         string   `json:"message"`
	PublicationDate string   `json:"publication_date"`
}

Result a query result

type ResultSet

type ResultSet struct {
	SearchTerm   string    `json:"searchTerm"`
	NumFound     int       `json:"numFound"`
	Start        int       `json:"start"`
	Next         int       `json:"next"`
	Docs         []*Result `json:"docs"`
	Error        bool      `json:"error"`
	ErrorMessage string    `json:"errormsg"`
}

ResultSet a list of results

Jump to

Keyboard shortcuts

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