storer

package
v0.0.0-...-ae5e3d9 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 9 Imported by: 0

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

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

func NewPostgresStorerWithID(ctx context.Context, pool *pgxpool.Pool, repoID int32) *PostgresStorer

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) Config

func (s *PostgresStorer) Config() (*config.Config, error)

func (*PostgresStorer) CountLooseRefs

func (s *PostgresStorer) CountLooseRefs() (int, error)

func (*PostgresStorer) EncodedObject

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) Index

func (s *PostgresStorer) Index() (*index.Index, 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 (*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

func (*PostgresStorer) Shallow

func (s *PostgresStorer) Shallow() ([]plumbing.Hash, error)

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.

Jump to

Keyboard shortcuts

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