ModelDBImpl class

An implementation of ModelDB based on model class annotations.

The two constructors will scan loaded dart libraries for classes with a Kind annotation.

An example on how to write a model class is: @Kind class Person extends db.Model { @StringProperty String name;

  @IntProperty
  int age;

  @DateTimeProperty
  DateTime dateOfBirth;
}

These classes must either extend Model or ExpandoModel. Furthermore they must have an empty default constructor which can be used to construct model objects when doing lookups/queries from datastore.

Implemented types

Constructors

ModelDBImpl()
Initializes a new ModelDB from all libraries.
ModelDBImpl.fromLibrary(Symbol librarySymbol)
Initializes a new ModelDB from all libraries.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

fieldNameToPropertyName(String kind, String fieldName) String?
Returns the name of the property corresponding to the kind kind and fieldName.
override
fromDatastoreEntity<T extends Model>(Entity? entity) → T?
Converts a ds.Entity to a Model instance.
override
fromDatastoreKey(Key datastoreKey) Key
Converts a ds.Key to a Key. The key returned will have the correct id type which is either Key<String> or Key<int>.
override
kindName(Type type) String
Returns the string representation of the kind of model class type.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDatastoreEntity(Model model) Entity
Converts a Model instance to a ds.Entity.
override
toDatastoreKey(Key dbKey) Key
Converts a Key to a ds.Key.
override
toDatastoreValue(String kind, String fieldName, Object? value, {bool forComparison = false}) Object?
Converts value according to the Property named name in type.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

hasDefaultConstructor(ClassMirror classMirror) bool
Returns true if the specified classMirror has a default (unnamed) constructor that accepts an empty arguments list.