Skip to content

Commit

Permalink
Postgress Upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimtsushko committed Nov 26, 2016
1 parent b0b59e5 commit c1fb97c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 98 deletions.
30 changes: 13 additions & 17 deletions lib/src/domain_model_generator.dart
Expand Up @@ -66,9 +66,9 @@ class PropertyType {
const PropertyType._internal(this._value);
String toString() => 'PropertyType.$_value';
static const PERSISTENT_OBJECT =
const PropertyType._internal('PERSISTENT_OBJECT');
const PropertyType._internal('PERSISTENT_OBJECT');
static const PERSISTENT_LIST =
const PropertyType._internal('PERSISTENT_LIST');
const PropertyType._internal('PERSISTENT_LIST');
static const SIMPLE = const PropertyType._internal('SIMPLE');
}

Expand All @@ -85,7 +85,7 @@ part of domain_model;
List<Type> _classesOrdered = [];
final Map<Type, List> _linkedTypes = new Map<Type, List>();
final Map<String, PropertyGenerator> fieldsMap =
new Map<String, PropertyGenerator>();
new Map<String, PropertyGenerator>();
ModelGenerator(this.libraryName);
StringBuffer output = new StringBuffer();
init() {
Expand Down Expand Up @@ -212,7 +212,7 @@ class PersistentObjectItem{
classGenerator.properties.forEach(generateOuputForProperty);
_linkedTypes[classGenerator.type] = classGenerator.properties
.where((PropertyGenerator p) =>
p.propertyType == PropertyType.PERSISTENT_OBJECT)
p.propertyType == PropertyType.PERSISTENT_OBJECT)
.map((PropertyGenerator p) => [p.name, p.type])
.toList();
output.write('}\n\n');
Expand All @@ -239,19 +239,19 @@ class PersistentObjectItem{

output
.write(' $typeStr get ${propertyGenerator.name} => '
"getProperty('${propertyGenerator.name}') $typeCast;\n");
"getProperty('${propertyGenerator.name}') $typeCast;\n");
output.write(
' set ${propertyGenerator.name} ($typeStr value) => '
"setProperty('${propertyGenerator.name}',value);\n");
"setProperty('${propertyGenerator.name}',value);\n");
}
if (propertyGenerator.propertyType == PropertyType.PERSISTENT_OBJECT) {
output.write(
' ${propertyGenerator.type} get ${propertyGenerator.name} => '
"getLinkedObject('${propertyGenerator.name}', ${propertyGenerator.type});\n");
"getLinkedObject('${propertyGenerator.name}', ${propertyGenerator.type});\n");

output.write(
' set ${propertyGenerator.name}(${propertyGenerator.type} value) => '
"setLinkedObject('${propertyGenerator.name}', value);\n");
"setLinkedObject('${propertyGenerator.name}', value);\n");

// String capitalized =
// propertyGenerator.name.substring(0, 1).toUpperCase() +
Expand All @@ -262,7 +262,7 @@ class PersistentObjectItem{
if (propertyGenerator.propertyType == PropertyType.PERSISTENT_LIST) {
output.write(
' ${propertyGenerator.type} get ${propertyGenerator.name} => '
"getPersistentList(${propertyGenerator.listElementType}.value('${propertyGenerator.name}'));\n");
"getPersistentList(${propertyGenerator.listElementType}.value('${propertyGenerator.name}'));\n");
}
}

Expand Down Expand Up @@ -294,9 +294,9 @@ class PersistentObjectItem{

allProperties.forEach((propertyGenerator) {
Type fieldType =
propertyGenerator.propertyType == PropertyType.PERSISTENT_OBJECT
? int
: propertyGenerator.type;
propertyGenerator.propertyType == PropertyType.PERSISTENT_OBJECT
? int
: propertyGenerator.type;
output.write(
" static Field<$fieldType> get ${propertyGenerator.name} =>\n");
output.write(
Expand Down Expand Up @@ -359,7 +359,7 @@ class PersistentObjectItem{
for (PropertyGenerator each in fieldsMap.values) {
if (each.field.parentTable != null) {
PropertyGenerator parentFieldGenerator =
fieldsMap['${each.field.parentTable}|${each.field.parentField}'];
fieldsMap['${each.field.parentTable}|${each.field.parentField}'];
if (parentFieldGenerator == null) {
throw new Exception(
'Parent field not found: ${each.field.parentTable} -> ${each.field.parentField}');
Expand Down Expand Up @@ -429,17 +429,13 @@ class PropertyGenerator {
}
Type t = vm.type.reflectedType;
type = t;
<<<<<<< HEAD
if (t == int ||
t == double ||
t == String ||
t == DateTime ||
t == Map ||
t == bool ||
t == num) {
=======
if (t == int || t == double || t == String || t == DateTime || t == bool || t == num) {
>>>>>>> develop
return;
}

Expand Down
20 changes: 0 additions & 20 deletions lib/src/persistent_object.dart
Expand Up @@ -5,27 +5,7 @@ import 'package:bson/bson.dart';
import 'objectory_base.dart';
import 'dart:async';
import 'dart:collection';
<<<<<<< HEAD
import 'schema.dart';
=======
import 'package:quiver/core.dart';
part 'persistent_list.dart';

enum PropertyType {
String,
int,
double,
bool,
DateTime,
num,
ObjectId,
LinkedObject,
EmbeddedPersistentObject,
List,
ListOfLinks,
ListOfEmbeddedObjects
}
>>>>>>> develop

PersistentObject getStub(int id) => new PersistentObject()..id = id;

Expand Down
9 changes: 6 additions & 3 deletions pubspec.yaml
@@ -1,22 +1,25 @@
name: objectory
version: 0.5.5
version: 0.5.1-dev
author: Vadim Tsushko <vadimtsushko@gmail.com>
description: Object document mapper/persistency layer for server-side and browser apps
homepage: https://github.com/vadimtsushko/objectory
environment:
sdk: '>=1.10.0 <2.0.0'
sdk: '>=0.8.10+6 <2.0.0'
dependencies:
browser: ^0.10.0
logging: ^0.11.2
logging_handlers: ^0.8.0
console_log_handler: ^0.2.1
mongo_dart: 0.2.9
mongo_dart_query: ^0.2.0
quiver: ^0.21.4
http: ^0.11.3
shelf: ^0.6.5
js: any
shelf_cors: ^0.2.1
postgresql: ^0.3.3
meta: ^1.0.4
dev_dependencies:
dart_style : ^0.2.11
args: ^0.13.4
hop: ^0.27.0
stream: ^1.5.3
Expand Down

0 comments on commit c1fb97c

Please sign in to comment.