Documentation
¶
Overview ¶
Package storer provides a go-git storage.Storer implementation backed by PostgreSQL.
Create a storer with NewPostgresStorer(ctx, pool, repoName). The repo is created if it does not exist. The returned *PostgresStorer implements storage.Storer and can be used with go-git's Repository (e.g. push, fetch, clone). Use RepoID to get the repository ID; use ListRefsRows for a single-query ref list when you do not need plumbing.Reference values.
Index ¶
- type PostgresStorer
- func (s *PostgresStorer) AddAlternate(remote string) error
- func (s *PostgresStorer) CheckAndSetReference(new, old *plumbing.Reference) error
- func (s *PostgresStorer) Config() (*config.Config, error)
- func (s *PostgresStorer) CountLooseRefs() (int, error)
- func (s *PostgresStorer) EncodedObject(t plumbing.ObjectType, h plumbing.Hash) (plumbing.EncodedObject, error)
- func (s *PostgresStorer) EncodedObjectSize(h plumbing.Hash) (int64, error)
- func (s *PostgresStorer) HasEncodedObject(h plumbing.Hash) error
- func (s *PostgresStorer) Index() (*index.Index, error)
- func (s *PostgresStorer) IterEncodedObjects(t plumbing.ObjectType) (storer.EncodedObjectIter, error)
- func (s *PostgresStorer) IterReferences() (storer.ReferenceIter, error)
- func (s *PostgresStorer) ListRefsRows() ([]RefRow, error)
- func (s *PostgresStorer) Module(name string) (storage.Storer, error)
- func (s *PostgresStorer) NewEncodedObject() plumbing.EncodedObject
- func (s *PostgresStorer) PackRefs() error
- func (s *PostgresStorer) Reference(n plumbing.ReferenceName) (*plumbing.Reference, error)
- func (s *PostgresStorer) RemoveReference(n plumbing.ReferenceName) error
- func (s *PostgresStorer) RepoID() int32
- func (s *PostgresStorer) SetConfig(cfg *config.Config) error
- func (s *PostgresStorer) SetEncodedObject(obj plumbing.EncodedObject) (plumbing.Hash, error)
- func (s *PostgresStorer) SetIndex(idx *index.Index) error
- func (s *PostgresStorer) SetReference(ref *plumbing.Reference) error
- func (s *PostgresStorer) SetShallow(commits []plumbing.Hash) error
- func (s *PostgresStorer) Shallow() ([]plumbing.Hash, error)
- type RefRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresStorer ¶
type PostgresStorer struct {
// contains filtered or unexported fields
}
PostgresStorer implements storage.Storer by storing objects and refs in PostgreSQL.
func NewPostgresStorer ¶
func NewPostgresStorer(ctx context.Context, pool *pgxpool.Pool, repoName string) (*PostgresStorer, error)
NewPostgresStorer returns a storer for the given repo (by name). Repo is created if missing.
func NewPostgresStorerWithID ¶
NewPostgresStorerWithID returns a storer for an existing repo by ID (e.g. after GetRepo).
func (*PostgresStorer) AddAlternate ¶
func (s *PostgresStorer) AddAlternate(remote string) error
func (*PostgresStorer) CheckAndSetReference ¶
func (s *PostgresStorer) CheckAndSetReference(new, old *plumbing.Reference) error
func (*PostgresStorer) CountLooseRefs ¶
func (s *PostgresStorer) CountLooseRefs() (int, error)
func (*PostgresStorer) EncodedObject ¶
func (s *PostgresStorer) EncodedObject(t plumbing.ObjectType, h plumbing.Hash) (plumbing.EncodedObject, error)
func (*PostgresStorer) EncodedObjectSize ¶
func (s *PostgresStorer) EncodedObjectSize(h plumbing.Hash) (int64, error)
func (*PostgresStorer) HasEncodedObject ¶
func (s *PostgresStorer) HasEncodedObject(h plumbing.Hash) error
func (*PostgresStorer) IterEncodedObjects ¶
func (s *PostgresStorer) IterEncodedObjects(t plumbing.ObjectType) (storer.EncodedObjectIter, error)
func (*PostgresStorer) IterReferences ¶
func (s *PostgresStorer) IterReferences() (storer.ReferenceIter, error)
func (*PostgresStorer) ListRefsRows ¶
func (s *PostgresStorer) ListRefsRows() ([]RefRow, error)
ListRefsRows returns all refs for this repo as RefRow slices.
func (*PostgresStorer) Module ¶
func (s *PostgresStorer) Module(name string) (storage.Storer, error)
ModuleStorer
func (*PostgresStorer) NewEncodedObject ¶
func (s *PostgresStorer) NewEncodedObject() plumbing.EncodedObject
EncodedObjectStorer
func (*PostgresStorer) PackRefs ¶
func (s *PostgresStorer) PackRefs() error
func (*PostgresStorer) Reference ¶
func (s *PostgresStorer) Reference(n plumbing.ReferenceName) (*plumbing.Reference, error)
func (*PostgresStorer) RemoveReference ¶
func (s *PostgresStorer) RemoveReference(n plumbing.ReferenceName) error
func (*PostgresStorer) RepoID ¶
func (s *PostgresStorer) RepoID() int32
RepoID returns the repository ID.
func (*PostgresStorer) SetConfig ¶
func (s *PostgresStorer) SetConfig(cfg *config.Config) error
ConfigStorer
func (*PostgresStorer) SetEncodedObject ¶
func (s *PostgresStorer) SetEncodedObject(obj plumbing.EncodedObject) (plumbing.Hash, error)
func (*PostgresStorer) SetIndex ¶
func (s *PostgresStorer) SetIndex(idx *index.Index) error
IndexStorer
func (*PostgresStorer) SetReference ¶
func (s *PostgresStorer) SetReference(ref *plumbing.Reference) error
ReferenceStorer
func (*PostgresStorer) SetShallow ¶
func (s *PostgresStorer) SetShallow(commits []plumbing.Hash) error
ShallowStorer
type RefRow ¶
type RefRow struct {
Name string // ref name
Oid []byte // 20-byte object ID for hash refs
Symbolic string // target ref name when SymbolicValid is true
SymbolicValid bool // true if this ref is symbolic
}
RefRow is one ref row from the DB: name, oid (20 bytes for hash refs), and optional symbolic target.