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/sagikazarmark/daggerverse/postgres@v0.3.0
Entrypoint
Return Type
Postgres !
Arguments
Name | Type | 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. |
Example
dagger -m github.com/sagikazarmark/daggerverse/postgres@ccca98362d39b3df2dcb538d6b4864686b833ee3 call \
func (m *myModule) example() *Postgres {
return dag.
Postgres()
}
@function
def example() -> dag.Postgres:
return (
dag.postgres()
)
@func()
example(): Postgres {
return dag
.postgres()
}
Types
Postgres 🔗
user() 🔗
Superuser name.
Return Type
Secret !
Example
dagger -m github.com/sagikazarmark/daggerverse/postgres@ccca98362d39b3df2dcb538d6b4864686b833ee3 call \
user
func (m *myModule) example() *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/sagikazarmark/daggerverse/postgres@ccca98362d39b3df2dcb538d6b4864686b833ee3 call \
password
func (m *myModule) example() *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/sagikazarmark/daggerverse/postgres@ccca98362d39b3df2dcb538d6b4864686b833ee3 call \
database
func (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/sagikazarmark/daggerverse/postgres@ccca98362d39b3df2dcb538d6b4864686b833ee3 call \
with-init-script --file file:path
func (m *myModule) example(file *File) *Postgres {
return dag.
Postgres().
WithInitScript(file)
}
@function
def example(file: dagger.File) -> dag.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/sagikazarmark/daggerverse/postgres@ccca98362d39b3df2dcb538d6b4864686b833ee3 call \
with-database --name string
func (m *myModule) example(name string) *Postgres {
return dag.
Postgres().
WithDatabase(name)
}
@function
def example(name: str) -> dag.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/sagikazarmark/daggerverse/postgres@ccca98362d39b3df2dcb538d6b4864686b833ee3 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()
}