queries

package
v0.0.0-...-f77d796 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrSQLNoRows = "sql: no rows in result set"
)

Some helpful constants.

Variables

This section is empty.

Functions

func IsRealError

func IsRealError(err error) bool

IsRealError returns true if err is non-nil and is not a "sql: no rows in result set" error

func Limit

func Limit(limit *int) int

Limit passes the provided limit, or, if not is provided, a default limit of 30.

func TimeRange

func TimeRange(
	ctx context.Context, exec boil.ContextExecutor, topic *models.Topic,
) (*models.Timerange, error)

TimeRange returns the time range for a topic.

func Topic

func Topic(actorID, topicID string) []qm.QueryMod

Topic looks for a topic within the topics that are visible to the current user.

func Transact

func Transact(db *sql.DB, txFunc func(*sql.Tx) error) (err error)

Transact provides a wrapper around a database transaction. https://stackoverflow.com/a/23502629/61048

Types

type LinkParentTopics

type LinkParentTopics struct {
	*models.View
	Link *models.LinkValue
}

LinkParentTopics returns the parent topics of a topic.

func (LinkParentTopics) Fetch

Fetch fetches the parent topics

type LinkQuery

type LinkQuery struct {
	First              *int
	IncludeDescendants bool
	Reviewed           *bool
	SearchString       *string
	Topic              *models.Topic
	View               *models.View
	Viewer             *models.User
}

LinkQuery holds common information for querying for links.

func (LinkQuery) Fetch

func (q LinkQuery) Fetch(ctx context.Context, exec boil.ContextExecutor) ([]*models.Link, error)

Fetch fetches the query

func (LinkQuery) Mods

func (q LinkQuery) Mods() []qm.QueryMod

Mods returns a set of query mods that can be used for querying for links.

type Search struct {
	*parser.QuerySpec
	// contains filtered or unexported fields
}

Search helps with the fetching of child topics and links

func NewSearch

func NewSearch(parentTopic *models.TopicValue, searchString *string) *Search

NewSearch returns a Search that can then be used to search for topics and links within a set of parent topics.

func (s Search) DescendantLinks(
	ctx context.Context, exec boil.ContextExecutor, limit int,
) ([]*models.Link, error)

DescendantLinks returns links within matching topics that match the search terms provided.

func (Search) DescendantTopics

func (s Search) DescendantTopics(
	ctx context.Context, exec boil.ContextExecutor, limit int,
) ([]*models.Topic, error)

DescendantTopics returns subtopics within matching topics that match the search terms provided.

type TopicParentTopics

type TopicParentTopics struct {
	*models.View
	Topic *models.Topic
}

TopicParentTopics returns the parent topics of a topic

func (TopicParentTopics) Fetch

Fetch fetches the parent topics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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