|
| 1 | +# Code generated by sqlc. DO NOT EDIT. |
| 2 | +from typing import AsyncIterator, Awaitable, Iterator, Optional, overload |
| 3 | + |
| 4 | +import sqlc_runtime as sqlc |
| 5 | + |
| 6 | +from authors import models |
| 7 | + |
| 8 | + |
| 9 | +CREATE_AUTHOR = """-- name: create_author :one |
| 10 | +INSERT INTO authors ( |
| 11 | + name, bio |
| 12 | +) VALUES ( |
| 13 | + $1, $2 |
| 14 | +) |
| 15 | +RETURNING id, name, bio |
| 16 | +""" |
| 17 | + |
| 18 | + |
| 19 | +DELETE_AUTHOR = """-- name: delete_author :exec |
| 20 | +DELETE FROM authors |
| 21 | +WHERE id = $1 |
| 22 | +""" |
| 23 | + |
| 24 | + |
| 25 | +GET_AUTHOR = """-- name: get_author :one |
| 26 | +SELECT id, name, bio FROM authors |
| 27 | +WHERE id = $1 LIMIT 1 |
| 28 | +""" |
| 29 | + |
| 30 | + |
| 31 | +LIST_AUTHORS = """-- name: list_authors :many |
| 32 | +SELECT id, name, bio FROM authors |
| 33 | +ORDER BY name |
| 34 | +""" |
| 35 | + |
| 36 | + |
| 37 | +@overload |
| 38 | +def create_author(conn: sqlc.Connection, name: str, bio: Optional[str]) -> Optional[models.Author]: |
| 39 | + pass |
| 40 | + |
| 41 | + |
| 42 | +@overload |
| 43 | +def create_author(conn: sqlc.AsyncConnection, name: str, bio: Optional[str]) -> Awaitable[Optional[models.Author]]: |
| 44 | + pass |
| 45 | + |
| 46 | + |
| 47 | +def create_author(conn: sqlc.GenericConnection, name: str, bio: Optional[str]) -> sqlc.ReturnType[Optional[models.Author]]: |
| 48 | + return conn.execute_one_model(models.Author, CREATE_AUTHOR, name, bio) |
| 49 | + |
| 50 | + |
| 51 | +@overload |
| 52 | +def delete_author(conn: sqlc.Connection, id: int) -> None: |
| 53 | + pass |
| 54 | + |
| 55 | + |
| 56 | +@overload |
| 57 | +def delete_author(conn: sqlc.AsyncConnection, id: int) -> Awaitable[None]: |
| 58 | + pass |
| 59 | + |
| 60 | + |
| 61 | +def delete_author(conn: sqlc.GenericConnection, id: int) -> sqlc.ReturnType[None]: |
| 62 | + return conn.execute_none(DELETE_AUTHOR, id) |
| 63 | + |
| 64 | + |
| 65 | +@overload |
| 66 | +def get_author(conn: sqlc.Connection, id: int) -> Optional[models.Author]: |
| 67 | + pass |
| 68 | + |
| 69 | + |
| 70 | +@overload |
| 71 | +def get_author(conn: sqlc.AsyncConnection, id: int) -> Awaitable[Optional[models.Author]]: |
| 72 | + pass |
| 73 | + |
| 74 | + |
| 75 | +def get_author(conn: sqlc.GenericConnection, id: int) -> sqlc.ReturnType[Optional[models.Author]]: |
| 76 | + return conn.execute_one_model(models.Author, GET_AUTHOR, id) |
| 77 | + |
| 78 | + |
| 79 | +@overload |
| 80 | +def list_authors(conn: sqlc.Connection) -> Iterator[models.Author]: |
| 81 | + pass |
| 82 | + |
| 83 | + |
| 84 | +@overload |
| 85 | +def list_authors(conn: sqlc.AsyncConnection) -> AsyncIterator[models.Author]: |
| 86 | + pass |
| 87 | + |
| 88 | + |
| 89 | +def list_authors(conn: sqlc.GenericConnection) -> sqlc.IteratorReturn[models.Author]: |
| 90 | + return conn.execute_many_model(models.Author, LIST_AUTHORS) |
| 91 | + |
| 92 | + |
0 commit comments