Dagger
Search

postgres

Module for building Postgres containers, serving a postgres service, or querying a running postgres database.

Installation

dagger install github.com/kpenfound/dagger-modules/postgres@v0.1.0

Entrypoint

Return Type
Postgres !
Arguments
NameTypeDescription
versionString The postgres container tag
Example
func (m *myModule) example() *Postgres  {
	return dag.
			Postgres()
}
@function
def example() -> dag.Postgres:
	return (
		dag.postgres()
	)
@func()
example(): Postgres {
	return dag
		.postgres()
}

Types

Postgres

version()

Return Type
String !
Example
dagger -m github.com/kpenfound/dagger-modules/postgres@57352e06a1cfbcb5307c009d37c0201b2719b935 call \
 version
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			Postgres().
			Version(ctx)
}
@function
async def example() -> str:
	return await (
		dag.postgres()
		.version()
	)
@func()
async example(): Promise<string> {
	return dag
		.postgres()
		.version()
}

withVersion()

Specify a tag of postgres to use

Return Type
Postgres !
Arguments
NameTypeDefault ValueDescription
versionString !-The postgres container tag
Example
dagger -m github.com/kpenfound/dagger-modules/postgres@57352e06a1cfbcb5307c009d37c0201b2719b935 call \
 with-version --version string \
 container
func (m *myModule) example(version string) *Postgres  {
	return dag.
			Postgres().
			WithVersion(version)
}
@function
def example(version: str) -> dag.Postgres:
	return (
		dag.postgres()
		.with_version(version)
	)
@func()
example(version: string): Postgres {
	return dag
		.postgres()
		.withVersion(version)
}

container()

Get the postgres container with the directory in it

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
platformString -The platform of the container
Example
dagger -m github.com/kpenfound/dagger-modules/postgres@57352e06a1cfbcb5307c009d37c0201b2719b935 call \
 container
func (m *myModule) example() *Container  {
	return dag.
			Postgres().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.postgres()
		.container()
	)
@func()
example(): Container {
	return dag
		.postgres()
		.container()
}

service()

Get a postgres container as a service

Return Type
Service !
Arguments
NameTypeDefault ValueDescription
platformString -The platform of the container
Example
dagger -m github.com/kpenfound/dagger-modules/postgres@57352e06a1cfbcb5307c009d37c0201b2719b935 call \
 service
func (m *myModule) example() *Service  {
	return dag.
			Postgres().
			Service()
}
@function
def example() -> dagger.Service:
	return (
		dag.postgres()
		.service()
	)
@func()
example(): Service {
	return dag
		.postgres()
		.service()
}

client()

Get a terminal of a psql client connected to a Postgres database

Return Type
Terminal !
Arguments
NameTypeDefault ValueDescription
serverService !-The Postgres server to connect to
dbString !-The postgres database
userString !-The postgres user
passwordString !-The postgres password
portString "5432"The postgres port
versionString "16"The postgres client container tag
Example
Function Postgres.client is not accessible from the postgres module
func (m *myModule) example(server *Service, db string, user string, password string) *Terminal  {
	return dag.
			Postgres().
			Client(server, db, user, password)
}
@function
def example(server: dagger.Service, db: str, user: str, password: str) -> dag.Terminal:
	return (
		dag.postgres()
		.client(server, db, user, password)
	)
@func()
example(server: Service, db: string, user: string, password: string): Terminal {
	return dag
		.postgres()
		.client(server, db, user, password)
}