Skip to content

Query Snippets

this service has no specific implementations other than the default mixins.

Class CommonMixin

class CommonMixin()

[view_source]

Mixin with common methods for services.

get

def get(id: int) -> Dict

[view_source]

Fetch one by ID

get_all

def get_all() -> List[Dict]

[view_source]

fetch all objects.

update

def update(id: int, data: Dict) -> Dict

[view_source]

Update by ID

create

def create(data: Dict) -> Dict

[view_source]

Create a new object with data

delete

def delete(id: int) -> None

[view_source]

Delete by ID

Class NameMixin

class NameMixin()

[view_source]

Mixin for nameable services (by name or slug).

exists

def exists(name_or_slug: str) -> bool

[view_source]

Check if an object with given name_or_slug exists

get_by_name

def get_by_name(name_or_slug: str) -> Optional[Dict]

[view_source]

Get by name or slug

get_id

def get_id(name_or_slug: str) -> Optional[int]

[view_source]

Get the ID for an object by name or slug, returns None if not found

Class PrintMixin

class PrintMixin()

[view_source]

Mixin class for printing data