goqldom

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: BSD-2-Clause Imports: 7 Imported by: 0

README

goqldom

GraphQL based HTTP service for DOM selections.

Development

Requirements (once to build)

install Yarn and Parcel

yarn global add parcel-bundler

install frontend dependencies

yarn install

install Govendor and GoReleaser

go get -u github.com/kardianos/govendor
go get -u github.com/goreleaser/goreleaser

synchronize service dependencies

govendor sync
Build frontend assets (for every frontend change)

serve it on the fly

parcel serve -d foo index.html

run Parcel to build the static assets

parcel build -d assets index.html

build the virtual file system assets_vfsdata.go of the static assets

go run service/vfs/generate.go
Run the service

just run the service main while developing

go run service/main.go
Test the release build

build the distribution without a tag

goreleaser --skip-publish --snapshot --rm-dist

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Schema

func Schema(version string) (graphql.Schema, error)

Types

type Document

type Document struct {
	Location string
	// contains filtered or unexported fields
}

func (*Document) Select

func (d *Document) Select(selector string) *Elements

func (*Document) Title

func (d *Document) Title() string

type Element

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

func (*Element) Attr

func (e *Element) Attr(selector string, key string) string

func (*Element) HTML

func (e *Element) HTML(selector string) (string, error)

func (*Element) Select

func (e *Element) Select(selector string) *Elements

func (*Element) Text

func (e *Element) Text(selector string) (string, error)

type Elements

type Elements struct {
	Element
}

func (*Elements) Elements

func (e *Elements) Elements(selector string) []*Element

type Node

type Node interface {
	Attr(selector string, key string) string
	HTML(selector string) (string, error)
	Text(selector string) (string, error)
}

type Resolver

type Resolver func(selector string, node Node) (interface{}, error)

type Response

type Response struct {
	StatusCode    int
	StatusMessage string
	ContentType   string
	Document      *Document
}

func ErrorResponse

func ErrorResponse(message string, err error) (*Response, error)

func GetResponse

func GetResponse(url string) (*Response, error)

type Selectable

type Selectable interface {
	Select(selector string) *Elements
}

Directories

Path Synopsis
vfs

Jump to

Keyboard shortcuts

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