models

package
v0.2.7-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2016 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// TableNamePackages is the name of the table containing the package model.
	TableNamePackages = "gophr.packages"
	// IndexNamePackages is the name of the lucene index
	IndexNamePackages             = "packages_index"
	ColumnNamePackagesRepo        = "repo"
	ColumnNamePackagesStars       = "stars"
	ColumnNamePackagesExists      = "exists"
	ColumnNamePackagesAuthor      = "author"
	ColumnNamePackagesVersions    = "versions"
	ColumnNamePackagesGodocURL    = "godoc_url"
	ColumnNamePackagesIndexTime   = "index_time"
	ColumnNamePackagesAwesomeGo   = "awesome_go"
	ColumnNamePackagesSearchBlob  = "search_blob"
	ColumnNamePackagesDescription = "description"
)

Constants directly related to interacting with the package model in the cassandra database.

Variables

This section is empty.

Functions

func DeletePackageModel

func DeletePackageModel(session *gocql.Session, packageModel *PackageModel) error

func FindPackageVersions

func FindPackageVersions(session *gocql.Session, author string, repo string) ([]string, error)

FindPackageVersions gets the versions of a package from the database. If no such package exists, or there were no versions for said package, then nil is returned.

func InsertPackage

func InsertPackage(
	session *gocql.Session,
	packageModel *PackageModel,
) error

InsertPackage inserts an individual package into the database.

func InsertPackages

func InsertPackages(
	session *gocql.Session,
	packageModels []*PackageModel,
) error

InsertPackages inserts a slice of package models into the database.

func IsPackageArchived

func IsPackageArchived(
	session *gocql.Session,
	author string,
	repo string,
	ref string,
) bool

IsPackageArchived returns true if a package version matching the parameters exists.

func RecordDailyDownload

func RecordDailyDownload(
	session *gocql.Session,
	author string,
	repo string,
	version string,
) error

RecordDailyDownload records a single download of specific package version.

func RecordPackageArchival

func RecordPackageArchival(
	session *gocql.Session,
	author string,
	repo string,
	ref string,
) error

RecordPackageArchival records that an archive of a package version exists.

Types

type PackageModel

type PackageModel struct {
	Repo        *string
	Stars       *int
	Exists      *bool
	Author      *string
	Versions    []string
	GodocURL    *string
	IndexTime   *time.Time
	AwesomeGo   *bool
	SearchBlob  *string
	Description *string
}

PackageModel is a struct representing one individual package in the database.

func FuzzySearchPackages

func FuzzySearchPackages(
	session *gocql.Session,
	searchText string,
) ([]*PackageModel, error)

FuzzySearchPackages finds a list of packages relevant to a query phrase string. The search takes author, package and description into account.

func NewPackageModelForInsert

func NewPackageModelForInsert(
	author string,
	exists bool,
	repo string,
	versions []string,
	godocURL string,
	indexTime time.Time,
	awesomeGo bool,
	description string,
	stars int,
) (*PackageModel, error)

NewPackageModelForInsert creates an instance of PackageModel that is optimized and validated for the insert operation in the database.

func NewPackageModelFromBulkSelect

func NewPackageModelFromBulkSelect(
	author string,
	repo string,
	description string,
) (*PackageModel, error)

NewPackageModelFromBulkSelect creates an instance of PackageModel that is optimized and validated for a select operation designed to get data about multiple packages from the database.

func NewPackageModelFromSingleSelect

func NewPackageModelFromSingleSelect(
	author string,
	exists bool,
	repo string,
	versions []string,
	godocURL string,
	awesomeGo bool,
	description string,
) (*PackageModel, error)

NewPackageModelFromSingleSelect creates an instance of PackageModel that is optimized and validated for a select operation designed to get data about a single package from the database.

func NewPackageModelTest

func NewPackageModelTest(
	author string,
	repo string,
	awesome_go bool,
	description string,
	exists bool,
	godoc_url string,
	index_time time.Time,
	search_blob string,
	versions []string,
	stars int,
) *PackageModel

TODO(Shikkic): Fix func name and attribute naming scheme

func ScanAllPackageModels

func ScanAllPackageModels(session *gocql.Session) ([]*PackageModel, error)

Jump to

Keyboard shortcuts

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