Documentation ¶
Index ¶
- Variables
- func NewDatabase(name string, pool *RepositoryPool) sql.Database
- func NewRowRepoIter(pool *RepositoryPool, iter RowRepoIter) (*rowRepoIter, error)
- func NewSessionBuilder(pool *RepositoryPool) server.SessionBuilder
- type Database
- type Repository
- type RepositoryIter
- type RepositoryPool
- type RowRepoIter
- type Session
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidGitQuerySession = errors.NewKind("expecting gitquery session, but received: %T")
ErrInvalidGitQuerySession is returned when some node expected a GitQuery session but received something else.
Functions ¶
func NewDatabase ¶ added in v0.6.0
func NewDatabase(name string, pool *RepositoryPool) sql.Database
NewDatabase creates a new Database structure and initializes its tables with the given pool
func NewRowRepoIter ¶ added in v0.10.0
func NewRowRepoIter( pool *RepositoryPool, iter RowRepoIter, ) (*rowRepoIter, error)
NewRowRepoIter initializes a new repository iterator.
* pool: is a RepositoryPool we want to iterate * iter: specific RowRepoIter interface
- NewIterator: called when a new repository is about to be iterated, returns a new RowRepoIter
- Next: called for each row
- Close: called when a repository finished iterating
func NewSessionBuilder ¶ added in v0.10.0
func NewSessionBuilder(pool *RepositoryPool) server.SessionBuilder
NewSessionBuilder creates a SessionBuilder with the given Repository Pool.
Types ¶
type Database ¶ added in v0.6.0
type Database struct {
// contains filtered or unexported fields
}
Database holds all git repository tables
type Repository ¶ added in v0.10.0
type Repository struct { ID string Repo *git.Repository }
Repository struct holds an initialized repository and its ID
func NewRepository ¶ added in v0.10.0
func NewRepository(id string, repo *git.Repository) Repository
NewRepository creates and initializes a new Repository structure
func NewRepositoryFromPath ¶ added in v0.10.0
func NewRepositoryFromPath(id, path string) (Repository, error)
NewRepositoryFromPath creates and initializes a new Repository structure and initializes a go-git repository
type RepositoryIter ¶ added in v0.10.0
type RepositoryIter struct {
// contains filtered or unexported fields
}
RepositoryIter iterates over all repositories in the pool
func (*RepositoryIter) Close ¶ added in v0.10.0
func (i *RepositoryIter) Close() error
Close finished iterator. It's no-op.
func (*RepositoryIter) Next ¶ added in v0.10.0
func (i *RepositoryIter) Next() (*Repository, error)
Next retrieves the next Repository. It returns io.EOF as error when there are no more Repositories to retrieve.
type RepositoryPool ¶ added in v0.10.0
type RepositoryPool struct {
// contains filtered or unexported fields
}
RepositoryPool holds a pool git repository paths and functionality to open and iterate them.
func NewRepositoryPool ¶ added in v0.10.0
func NewRepositoryPool() RepositoryPool
NewRepositoryPool initializes a new RepositoryPool
func (*RepositoryPool) Add ¶ added in v0.10.0
func (p *RepositoryPool) Add(id, path string)
Add inserts a new repository in the pool
func (*RepositoryPool) AddDir ¶ added in v0.10.0
func (p *RepositoryPool) AddDir(path string) error
AddDir adds all direct subdirectories from path as repos
func (*RepositoryPool) AddGit ¶ added in v0.10.0
func (p *RepositoryPool) AddGit(path string) (string, error)
AddGit checks if a git repository can be opened and adds it to the pool. It also sets its path as ID.
func (*RepositoryPool) GetPos ¶ added in v0.10.0
func (p *RepositoryPool) GetPos(pos int) (*Repository, error)
GetPos retrieves a repository at a given position. If the position is out of bounds it returns io.EOF
func (*RepositoryPool) RepoIter ¶ added in v0.10.0
func (p *RepositoryPool) RepoIter() (*RepositoryIter, error)
RepoIter creates a new Repository iterator
type RowRepoIter ¶ added in v0.10.0
type RowRepoIter interface { NewIterator(*Repository) (RowRepoIter, error) Next() (sql.Row, error) Close() error }
RowRepoIter is the interface needed by each iterator implementation
type Session ¶ added in v0.10.0
type Session struct { sql.Session Pool *RepositoryPool }
Session is the custom implementation of a gitquery session.
func NewSession ¶ added in v0.10.0
func NewSession(ctx context.Context, pool *RepositoryPool) *Session
NewSession creates a new Session.