postgres
This module is aimed at providing a simple way to launch a Postgres database server for development and testing purposes.Check out the official Postgres image on Docker Hub for further customization options: https://hub.docker.com/_/postgres
Installation
dagger install github.com/luanmtruong/daggerverse/postgres@96c13b929c636316317f745ff36cda4e4c66f680Entrypoint
Return Type
Postgres !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| version | String | - | Version (image tag) to use from the official image repository as a base container. | 
| container | Container | - | Custom container to use as a base container. Takes precedence over version. | 
| user | Secret | - | Superuser name. (default "postgres") | 
| password | Secret | - | Superuser password. (defaults "postgres") | 
| database | String | - | The database name. (defaults to the user name) | 
| dataVolume | CacheVolume | - | Mount a volume to persist data between runs. | 
| initScripts | Directory | - | Initialization scripts (*.sql and *.sh) to run when the service first starts. | 
| initdbArgs | [String ! ] | - | Additional arguments to pass to initdb. | 
| name | String | - | Instance name (allowing to spawn multiple services with the same parameters). | 
Example
dagger -m github.com/luanmtruong/daggerverse/postgres@96c13b929c636316317f745ff36cda4e4c66f680 call \
func (m *MyModule) Example() *dagger.Postgres  {
	return dag.
			Postgres()
}@function
def example() -> dagger.Postgres:
	return (
		dag.postgres()
	)@func()
example(): Postgres {
	return dag
		.postgres()
}Types
Postgres 🔗
user() 🔗
Superuser name.
Return Type
Secret ! Example
dagger -m github.com/luanmtruong/daggerverse/postgres@96c13b929c636316317f745ff36cda4e4c66f680 call \
 userfunc (m *MyModule) Example() *dagger.Secret  {
	return dag.
			Postgres().
			User()
}@function
def example() -> dagger.Secret:
	return (
		dag.postgres()
		.user()
	)@func()
example(): Secret {
	return dag
		.postgres()
		.user()
}password() 🔗
Superuser password.
Return Type
Secret ! Example
dagger -m github.com/luanmtruong/daggerverse/postgres@96c13b929c636316317f745ff36cda4e4c66f680 call \
 passwordfunc (m *MyModule) Example() *dagger.Secret  {
	return dag.
			Postgres().
			Password()
}@function
def example() -> dagger.Secret:
	return (
		dag.postgres()
		.password()
	)@func()
example(): Secret {
	return dag
		.postgres()
		.password()
}database() 🔗
The database name.
Return Type
String ! Example
dagger -m github.com/luanmtruong/daggerverse/postgres@96c13b929c636316317f745ff36cda4e4c66f680 call \
 databasefunc (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Postgres().
			Database(ctx)
}@function
async def example() -> str:
	return await (
		dag.postgres()
		.database()
	)@func()
async example(): Promise<string> {
	return dag
		.postgres()
		.database()
}withInitScript() 🔗
Add an additional initialization script to run when the service first starts.
Return Type
Postgres !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| file | File ! | - | No description provided | 
Example
dagger -m github.com/luanmtruong/daggerverse/postgres@96c13b929c636316317f745ff36cda4e4c66f680 call \
 with-init-script --file file:pathfunc (m *MyModule) Example(file *dagger.File) *dagger.Postgres  {
	return dag.
			Postgres().
			WithInitScript(file)
}@function
def example(file: dagger.File) -> dagger.Postgres:
	return (
		dag.postgres()
		.with_init_script(file)
	)@func()
example(file: File): Postgres {
	return dag
		.postgres()
		.withInitScript(file)
}withDatabase() 🔗
Creates an additional database with the given name (with the default user as the owner) when the service first starts.
Under the hood, this method adds a SQL script to the init scripts that creates the database.
Return Type
Postgres !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| name | String ! | - | Database to create. | 
Example
dagger -m github.com/luanmtruong/daggerverse/postgres@96c13b929c636316317f745ff36cda4e4c66f680 call \
 with-database --name stringfunc (m *MyModule) Example(name string) *dagger.Postgres  {
	return dag.
			Postgres().
			WithDatabase(name)
}@function
def example(name: str) -> dagger.Postgres:
	return (
		dag.postgres()
		.with_database(name)
	)@func()
example(name: string): Postgres {
	return dag
		.postgres()
		.withDatabase(name)
}service() 🔗
The Postgres service.
Return Type
Service ! Example
dagger -m github.com/luanmtruong/daggerverse/postgres@96c13b929c636316317f745ff36cda4e4c66f680 call \
 servicefunc (m *MyModule) Example() *dagger.Service  {
	return dag.
			Postgres().
			Service()
}@function
def example() -> dagger.Service:
	return (
		dag.postgres()
		.service()
	)@func()
example(): Service {
	return dag
		.postgres()
		.service()
}