# Path: oslo_db/sqlalchemy/types.py
# class JsonEncodedType(TypeDecorator):
# class JsonEncodedDict(JsonEncodedType):
# class JsonEncodedList(JsonEncodedType):
# class SoftDeleteInteger(TypeDecorator):
# class String(_String):
#     def __init__(self, mysql_as_long=False, mysql_as_medium=False):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def process_bind_param(self, value, dialect):
#     def __init__(
#             self, length, mysql_ndb_length=None, mysql_ndb_type=None, **kw):


from oslo_utils import timeutils
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy.orm import object_mapper
from oslo_db.sqlalchemy import types
    def items(self):
        """Make the model object behave like a dict."""
        return self._as_dict().items()

    def keys(self):
        """Make the model object behave like a dict."""
        return [key for key, value in self.iteritems()]


class ModelIterator(object):

    def __init__(self, model, columns):
        self.model = model
        self.i = columns

    def __iter__(self):
        return self

    def __next__(self):
        n = next(self.i)
        return n, getattr(self.model, n)


class TimestampMixin(object):
    created_at = Column(DateTime, default=lambda: timeutils.utcnow())
    updated_at = Column(DateTime, onupdate=lambda: timeutils.utcnow())


class SoftDeleteMixin(object):
    deleted_at = Column(DateTime)

# Path: oslo_db/sqlalchemy/types.py
# class JsonEncodedType(TypeDecorator):
# class JsonEncodedDict(JsonEncodedType):
# class JsonEncodedList(JsonEncodedType):
# class SoftDeleteInteger(TypeDecorator):
# class String(_String):
#     def __init__(self, mysql_as_long=False, mysql_as_medium=False):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def process_bind_param(self, value, dialect):
#     def __init__(
#             self, length, mysql_ndb_length=None, mysql_ndb_type=None, **kw):


# Path: oslo_db/sqlalchemy/models.py
from oslo_utils import timeutils
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy.orm import object_mapper
from oslo_db.sqlalchemy import types

    def items(self):
        """Make the model object behave like a dict."""
        return self._as_dict().items()

    def keys(self):
        """Make the model object behave like a dict."""
        return [key for key, value in self.iteritems()]


class ModelIterator(object):

    def __init__(self, model, columns):
        self.model = model
        self.i = columns

    def __iter__(self):
        return self

    def __next__(self):
        n = next(self.i)
        return n, getattr(self.model, n)


class TimestampMixin(object):
    created_at = Column(DateTime, default=lambda: timeutils.utcnow())
    updated_at = Column(DateTime, onupdate=lambda: timeutils.utcnow())


class SoftDeleteMixin(object):
    deleted_at = Column(DateTime)

    deleted = Column(types.SoftDeleteInteger, default=0)