pgxpublications

package
v0.2024.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExpectedVersion = status.Error(codes.FailedPrecondition, "expected latest version does not match")

Functions

func CreatePublication

func CreatePublication(ctx context.Context, tx pgx.Tx, id string, audience string) error

func CreatePublicationAcknowledgement

func CreatePublicationAcknowledgement(ctx context.Context, tx pgx.Tx, pubID, versionID string, t time.Time, accept bool,
	reason string, idempotent bool) error

func CreatePublicationVersion

func CreatePublicationVersion(ctx context.Context, tx pgx.Tx, data PublicationVersion) (id string, err error)

func DeletePublication

func DeletePublication(ctx context.Context, tx pgx.Tx, id string, idempotent bool) error

func GetLatestVersionID

func GetLatestVersionID(ctx context.Context, tx pgx.Tx, pubID string) (version string, err error)

func GetPublication

func GetPublication(ctx context.Context, tx pgx.Tx, pubID, versionID string) (*traits.Publication, error)

func GetPublicationIDForVersion

func GetPublicationIDForVersion(ctx context.Context, tx pgx.Tx, versionID string) (pubID string, err error)

func GetPublicationsPaginated

func GetPublicationsPaginated(ctx context.Context, tx pgx.Tx, token string, limit int) (publications []*traits.Publication, nextToken string, err error)

func SetupDB

func SetupDB(ctx context.Context, pool *pgxpool.Pool) error

Types

type Acknowledgement

type Acknowledgement struct {
	ID             string
	Accepted       bool
	RejectedReason string
	Time           time.Time
}

func GetAcknowledgement

func GetAcknowledgement(ctx context.Context, tx pgx.Tx, versionID string) (*Acknowledgement, error)

GetAcknowledgement retrieves the acknowledgement state of a particular publication version. If the version has not been acknowledged, returns a nil Acknowledgement.

type Option

type Option func(server *Server)

func WithLogger

func WithLogger(logger *zap.Logger) Option

type PublicationVersion

type PublicationVersion struct {
	ID            string
	PublicationID string
	PublishTime   time.Time
	Body          []byte
	MediaType     string
	Changelog     string
}

type Server

type Server struct {
	traits.UnimplementedPublicationApiServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, connStr string) (*Server, error)

func NewServerFromPool

func NewServerFromPool(ctx context.Context, pool *pgxpool.Pool, opts ...Option) (*Server, error)

func (*Server) AcknowledgePublication

func (p *Server) AcknowledgePublication(ctx context.Context, request *traits.AcknowledgePublicationRequest) (*traits.Publication, error)

func (*Server) CreatePublication

func (p *Server) CreatePublication(ctx context.Context, request *traits.CreatePublicationRequest) (*traits.Publication, error)

func (*Server) DeletePublication

func (p *Server) DeletePublication(ctx context.Context, request *traits.DeletePublicationRequest) (*traits.Publication, error)

func (*Server) GetPublication

func (p *Server) GetPublication(ctx context.Context, request *traits.GetPublicationRequest) (*traits.Publication, error)

func (*Server) ListPublications

func (*Server) UpdatePublication

func (p *Server) UpdatePublication(ctx context.Context, request *traits.UpdatePublicationRequest) (*traits.Publication, error)

Jump to

Keyboard shortcuts

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