mpostgres

package
v1.38.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pagination

type Pagination struct {
	Items      any       `json:"items"`
	Page       int       `json:"page,omitempty" example:"1"`
	PrevCursor string    `json:"prev_cursor,omitempty" example:"MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwMA==" extensions:"x-omitempty"`
	NextCursor string    `json:"next_cursor,omitempty" example:"MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwMA==" extensions:"x-omitempty"`
	Limit      int       `json:"limit" example:"10"`
	SortOrder  string    `json:"-" example:"asc"`
	StartDate  time.Time `json:"-" example:"2021-01-01"`
	EndDate    time.Time `json:"-" example:"2021-12-31"`

} // @name Pagination

Pagination is a struct designed to encapsulate pagination response payload data.

swagger:model Pagination @Description Pagination is the struct designed to store the pagination data of an entity list.

func (*Pagination) SetCursor added in v1.31.0

func (p *Pagination) SetCursor(next, prev string)

SetCursor set the next and previous cursor.

func (*Pagination) SetItems

func (p *Pagination) SetItems(items any)

SetItems set an array of any struct in items.

type PostgresConnection

type PostgresConnection struct {
	ConnectionStringPrimary string
	ConnectionStringReplica string
	PrimaryDBName           string
	ReplicaDBName           string
	ConnectionDB            *dbresolver.DB
	Connected               bool
	Component               string
	Logger                  mlog.Logger
}

PostgresConnection is a hub which deal with postgres connections.

func (*PostgresConnection) Connect

func (pc *PostgresConnection) Connect() error

Connect keeps a singleton connection with postgres.

func (*PostgresConnection) GetDB

func (pc *PostgresConnection) GetDB() (dbresolver.DB, error)

GetDB returns a pointer to the postgres connection, initializing it if necessary.

Jump to

Keyboard shortcuts

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