How to use the fireo.queries.base_query.BaseQuery function in fireo

To help you get started, we’ve selected a few fireo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github octabytes / FireO / src / fireo / queries / create_query.py View on Github external
from fireo.fields import NestedModel
from fireo.queries import query_wrapper
from fireo.queries.base_query import BaseQuery
from fireo.utils import utils


class CreateQuery(BaseQuery):
    """Insert model into firestore

    Methods
    ------
    _doc_ref():
        create document ref from firestore

    _parse_field():
        Get and return `db_value` from model `_meta`

    _raw_exec():
        save model into firestore and return the document

    exec():
        return modified or new instance of model
    """
github octabytes / FireO / src / fireo / queries / get_query.py View on Github external
from fireo.queries import query_wrapper
from fireo.queries.base_query import BaseQuery
from fireo.utils import utils


class GetQuery(BaseQuery):
    """Get model from firestore

    Get model from firestore using Managers

    Examples
    --------
    .. code-block:: python
        class User(Mode):
            name = TextField()
            age = NumberField()

        u = User(name="Azeem", age=26)
        u.save()

        # Getting model
        user = User.collection.get(u.key)
github octabytes / FireO / src / fireo / queries / delete_query.py View on Github external
from fireo.queries.base_query import BaseQuery
from fireo.utils import utils
from fireo.database import db


class DeleteQuery(BaseQuery):
    """Delete Document from firestore

    Example
    ------
    .. code-block:: python
        class User(Mode):
            name = TextField()
            age = NumberField()

        u = User(name="Azeem", age=26)
        u.save()

        # Deleting model
        id = User.collection.delete(u.id)
        print(id)
github octabytes / FireO / src / fireo / queries / update_query.py View on Github external
from fireo.fields import DateTime, NestedModel
from fireo.queries import query_wrapper
from fireo.queries.base_query import BaseQuery
from fireo.utils import utils


class UpdateQuery(BaseQuery):
    """Update document in firestore

    Methods
    ------
    _doc_ref():
        create document ref from firestore

    _parse_field():
        Get and return `db_value` from model `_meta`

    _raw_exec(transaction_or_batch):
        Update document in firestore and return the document

    exec(transaction_or_batch):
        return modified instance of model
    """
github octabytes / FireO / src / fireo / queries / filter_query.py View on Github external
from fireo.database import db
from fireo.fields.errors import FieldNotFound
from fireo.queries import query_wrapper
from fireo.queries.base_query import BaseQuery
from fireo.queries.delete_query import DeleteQuery
from fireo.queries.query_iterator import QueryIterator
from fireo.utils import utils
from google.cloud import firestore


class FilterQuery(BaseQuery):
    """Filter documents on the bases of where clauses

    Filter document by filed name, You can also sort and limit the documents.

    Attributes
    ----------
    model: Model
        Model instance

    select_query: list
        Where filter

    n_limit: int
        Number of documents

    oderer_by: list
github octabytes / FireO / src / fireo / queries / create_query.py View on Github external
import inspect

from fireo.queries import query_wrapper
from fireo.queries.base_query import BaseQuery


class CreateQuery(BaseQuery):
    """Insert model into firestore

    Methods
    ------
    _doc_ref():
        create document ref from firestore

    _parse_field():
        Get and return `db_value` from model `_meta`

    _raw_exec():
        save model into firestore and return the document

    exec():
        return modified or new instance of model
    """