postgres
No long description provided.
Installation
dagger install github.com/grouville/daggerverse-tom/postgres@2b30c86c46201e470748df42505da8e77af3bd54
Entrypoint
Return Type
Postgres
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 🔗
user() 🔗
Return Type
Secret !
Example
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() 🔗
Return Type
Secret !
Example
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()
}
name() 🔗
Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string {
return dag.
Postgres().
Name(ctx)
}
@function
async def example() -> str:
return await (
dag.postgres()
.name()
)
@func()
async example(): Promise<string> {
return dag
.postgres()
.name()
}
port() 🔗
Return Type
Integer !
Example
func (m *myModule) example(ctx context.Context) int {
return dag.
Postgres().
Port(ctx)
}
@function
async def example() -> int:
return await (
dag.postgres()
.port()
)
@func()
async example(): Promise<number> {
return dag
.postgres()
.port()
}
version() 🔗
Return Type
String !
Example
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()
}
configFile() 🔗
Return Type
File !
Example
func (m *myModule) example() *File {
return dag.
Postgres().
ConfigFile()
}
@function
def example() -> dagger.File:
return (
dag.postgres()
.config_file()
)
@func()
example(): File {
return dag
.postgres()
.configFile()
}
initScripts() 🔗
Return Type
[InitScript ! ] !
Example
func (m *myModule) example() []*PostgresInitScript {
return dag.
Postgres().
InitScripts()
}
@function
def example() -> List[dag.PostgresInitScript]:
return (
dag.postgres()
.init_scripts()
)
@func()
example(): PostgresInitScript[] {
return dag
.postgres()
.initScripts()
}
cache() 🔗
Return Type
Boolean !
Example
func (m *myModule) example(ctx context.Context) bool {
return dag.
Postgres().
Cache(ctx)
}
@function
async def example() -> bool:
return await (
dag.postgres()
.cache()
)
@func()
async example(): Promise<boolean> {
return dag
.postgres()
.cache()
}
withCredential() 🔗
WithCredential adds a user and a password configuration to the postgresSQL
database.
The values will be set in container as secret variables: POSTGRES_USER
POSTGRES_PASSWORD
.
Return Type
Postgres !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
user | Secret ! | - | No description provided |
password | Secret ! | - | No description provided |
Example
func (m *myModule) example(user *Secret, password *Secret) *Postgres {
return dag.
Postgres().
WithCredential(user, password)
}
@function
def example(user: dagger.Secret, password: dagger.Secret) -> dag.Postgres:
return (
dag.postgres()
.with_credential(user, password)
)
@func()
example(user: Secret, password: Secret): Postgres {
return dag
.postgres()
.withCredential(user, password)
}
withPort() 🔗
WithPort configs an exposed port on the container.
Return Type
Postgres !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
port | Integer ! | - | No description provided |
Example
func (m *myModule) example(port int) *Postgres {
return dag.
Postgres().
WithPort(port)
}
@function
def example(port: int) -> dag.Postgres:
return (
dag.postgres()
.with_port(port)
)
@func()
example(port: number): Postgres {
return dag
.postgres()
.withPort(port)
}
withDatabaseName() 🔗
WithDatabaseName sets the name of the database that will be created on start.
It will be set in the container as POSTGRES_DB
, if it’s not set, the
database’s name will be the user’s one.
Return Type
Postgres !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
name | String ! | - | No description provided |
Example
func (m *myModule) example(name string) *Postgres {
return dag.
Postgres().
WithDatabaseName(name)
}
@function
def example(name: str) -> dag.Postgres:
return (
dag.postgres()
.with_database_name(name)
)
@func()
example(name: string): Postgres {
return dag
.postgres()
.withDatabaseName(name)
}
withCache() 🔗
Return Type
Postgres !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
cache | Boolean ! | - | No description provided |
Example
func (m *myModule) example(cache bool) *Postgres {
return dag.
Postgres().
WithCache(cache)
}
@function
def example(cache: bool) -> dag.Postgres:
return (
dag.postgres()
.with_cache(cache)
)
@func()
example(cache: boolean): Postgres {
return dag
.postgres()
.withCache(cache)
}
withVersion() 🔗
WithVersion sets the version of postgresql to pull from the registry.
Return Type
Postgres !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
version | String ! | - | No description provided |
Example
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)
}
withConfigFile() 🔗
WithConfigFile adds an extra config file to the postgres database.
This file will be copied in the container to
/usr/share/postgresql/postgresql.conf
Return Type
Postgres !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
file | File ! | - | No description provided |
Example
func (m *myModule) example(file *File) *Postgres {
return dag.
Postgres().
WithConfigFile(file)
}
@function
def example(file: dagger.File) -> dag.Postgres:
return (
dag.postgres()
.with_config_file(file)
)
@func()
example(file: File): Postgres {
return dag
.postgres()
.withConfigFile(file)
}
withInitScript() 🔗
WithInitScript adds a script to execute when the database is started.
You can call this function multiple times to add multiple scripts.
These scripts are stored in a map, so it’s recommended to name with a numeric
value at the beginning to make sure they are executed in the correct order.
For example 1-init.sql
, 2-new-tabs.sql
…
Theses files will be copied to /docker-entrypoint-initdb.db
Return Type
Postgres !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
name | String ! | - | No description provided |
script | File ! | - | No description provided |
Example
func (m *myModule) example(name string, script *File) *Postgres {
return dag.
Postgres().
WithInitScript(name, script)
}
@function
def example(name: str, script: dagger.File) -> dag.Postgres:
return (
dag.postgres()
.with_init_script(name, script)
)
@func()
example(name: string, script: File): Postgres {
return dag
.postgres()
.withInitScript(name, script)
}
cli() 🔗
Client returns a configured client with user and password set. Note: if you want to set the host, you can append this option on usage
Return Type
Container !
Example
func (m *myModule) example() *Container {
return dag.
Postgres().
Cli()
}
@function
def example() -> dagger.Container:
return (
dag.postgres()
.cli()
)
@func()
example(): Container {
return dag
.postgres()
.cli()
}
database() 🔗
Database returns a ready to run Postgres container with all configuration applied.
Return Type
Container !
Example
func (m *myModule) example() *Container {
return dag.
Postgres().
Database()
}
@function
def example() -> dagger.Container:
return (
dag.postgres()
.database()
)
@func()
example(): Container {
return dag
.postgres()
.database()
}
InitScript 🔗
file() 🔗
Return Type
File !
Example
Function PostgresInitScript.file is not accessible from the postgres module
Function PostgresInitScript.file is not accessible from the postgres module
Function PostgresInitScript.file is not accessible from the postgres module
name() 🔗
Return Type
String !
Example
Function PostgresInitScript.name is not accessible from the postgres module
Function PostgresInitScript.name is not accessible from the postgres module
Function PostgresInitScript.name is not accessible from the postgres module