mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 00:00:46 +00:00
Update script readme (#1930)
* Update script readme * Types better added
This commit is contained in:
@@ -96,20 +96,28 @@ You can build your entire infra on top of Windmill!
|
||||
## Show me some actual script code
|
||||
|
||||
```typescript
|
||||
import * as wmill from "https://deno.land/x/windmill@v1.62.0/mod.ts";
|
||||
//import any dependency from npm
|
||||
|
||||
import * as wmill from "https://deno.land/x/windmill@v1.136.0/mod.ts"
|
||||
import cowsay from "npm:cowsay@1.5.0";
|
||||
|
||||
// fill the type, or use the +Resource type to get a type-safe reference to a resource
|
||||
type Postgresql = {
|
||||
host: string,
|
||||
port: number,
|
||||
user: string,
|
||||
dbname: string,
|
||||
sslmode: string,
|
||||
password: string
|
||||
|
||||
}
|
||||
|
||||
export async function main(
|
||||
a: number,
|
||||
// unions generate enums
|
||||
b: "my" | "enum",
|
||||
// default parameters prefill the field
|
||||
d = "default arg",
|
||||
// nested objects work c = { nested: "object" },
|
||||
// permissioned and typed json
|
||||
db: wmill.Resource<"postgresql">
|
||||
c: Postgresql,
|
||||
d = "inferred type string from default arg",
|
||||
e = { nested: "object" },
|
||||
//f: wmill.Base64
|
||||
) {
|
||||
const email = Deno.env.get("WM_EMAIL");
|
||||
// variables are permissioned and by path
|
||||
|
||||
Reference in New Issue
Block a user