crawler

package
v0.0.0-...-75add70 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

*

  • Copyright (c) 2019-present Future Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

*

  • Copyright (c) 2019-present Future Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Index

Constants

View Source
const MaxPageSize = 100

Variables

This section is empty.

Functions

func Contains

func Contains(arr []int, e int) bool

Types

type Crawler

type Crawler interface {
	Search(ctx context.Context, words []string) (Repositories, error)
	FulfillForkSource(ctx context.Context, repos Repositories) (Repositories, error)
}

func NewGitHubCrawler

func NewGitHubCrawler(token string) Crawler

type File

type File struct {
	URL       string
	Fragments []string
}

Fragments is represents github api result https://developer.github.com/v3/search/#text-match-metadata

type Files

type Files []File

func (Files) Index

func (fs Files) Index(file File) int

func (Files) Merge

func (fs Files) Merge(f File) Files

type Repositories

type Repositories []Repository

func (Repositories) Exclude

func (rs Repositories) Exclude(targetIndexes []int) Repositories

func (Repositories) Index

func (rs Repositories) Index(r Repository) (index int)

func (Repositories) Merge

func (rs Repositories) Merge(r Repository) Repositories

type Repository

type Repository struct {
	URL        string
	Owner      string
	Name       string
	HitFiles   Files
	ForkSource string // parent is the repository this repository was forked from, source is the ultimate source for the network. https://developer.github.com/v3/repos/#response-4
}

Jump to

Keyboard shortcuts

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