store

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. See License.txt for license information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IssueStore

type IssueStore interface {
	Save(issue *model.Issue) (*model.Issue, error)
	Get(repoOwner, repoName string, number int) (*model.Issue, error)
}

func NewSQLIssueStore

func NewSQLIssueStore(sqlStore *SQLStore) IssueStore

type LockStore added in v0.15.0

type LockStore interface {
	Lock(ctx context.Context) error
	Unlock() error
}

type Mutex added in v0.15.0

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

Mutex is similar to sync.Mutex, except usable by morph to lock the db.

Pick a unique name for each mutex your plugin requires.

A Mutex must not be copied after first use.

func NewMutexStore added in v0.15.0

func NewMutexStore(key string, db *sql.DB) (*Mutex, error)

NewMutex creates a mutex with the given key name.

returns error if key is empty.

func (*Mutex) Lock added in v0.15.0

func (m *Mutex) Lock(ctx context.Context) error

Lock locks m unless the context is canceled. If the mutex is already locked by any other instance, including the current one, the calling goroutine blocks until the mutex can be locked, or the context is canceled.

The mutex is locked only if a nil error is returned.

func (*Mutex) Unlock added in v0.15.0

func (m *Mutex) Unlock() error

Unlock unlocks m. It is a run-time error if m is not locked on entry to Unlock.

Just like sync.Mutex, a locked Lock is not associated with a particular goroutine or a process.

type PullRequestStore

type PullRequestStore interface {
	Save(pr *model.PullRequest) (*model.PullRequest, error)
	Get(repoOwner, repoName string, number int) (*model.PullRequest, error)
	ListOpen() ([]*model.PullRequest, error)
}

func NewSQLPullRequestStore

func NewSQLPullRequestStore(sqlStore *SQLStore) PullRequestStore

type SQLIssueStore

type SQLIssueStore struct {
	*SQLStore
}

func (SQLIssueStore) Get

func (s SQLIssueStore) Get(repoOwner, repoName string, number int) (*model.Issue, error)

func (SQLIssueStore) Save

func (s SQLIssueStore) Save(issue *model.Issue) (*model.Issue, error)

type SQLPullRequestStore

type SQLPullRequestStore struct {
	*SQLStore
}

func (SQLPullRequestStore) Get

func (s SQLPullRequestStore) Get(repoOwner, repoName string, number int) (*model.PullRequest, error)

func (SQLPullRequestStore) ListOpen

func (s SQLPullRequestStore) ListOpen() ([]*model.PullRequest, error)

func (SQLPullRequestStore) Save

type SQLStore

type SQLStore struct {
	SchemaVersion string
	// contains filtered or unexported fields
}

func (*SQLStore) Close

func (ss *SQLStore) Close()

func (*SQLStore) DropAllTables

func (ss *SQLStore) DropAllTables()

func (*SQLStore) Issue

func (ss *SQLStore) Issue() IssueStore

func (*SQLStore) Mutex added in v0.15.0

func (ss *SQLStore) Mutex() LockStore

func (*SQLStore) PullRequest

func (ss *SQLStore) PullRequest() PullRequestStore

type Store

type Store interface {
	PullRequest() PullRequestStore
	Issue() IssueStore
	Close()
	DropAllTables()
	Mutex() LockStore
}

func NewSQLStore

func NewSQLStore(driverName, dataSource string) (Store, error)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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