This commit is contained in:
thosakwe 2016-12-21 16:33:07 -05:00
parent 0790b41110
commit f25c40280d
2 changed files with 7 additions and 27 deletions

View file

@ -124,7 +124,7 @@ class $name extends MemoryModel {
factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json)); factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json));
factory $name.fromMap(Map data) => new $name( factory $name.fromMap(Map data) => new $name(
id: data['id'] id: data['id'],
name: data['name'], name: data['name'],
desc: data['desc']); desc: data['desc']);
@ -141,33 +141,13 @@ class $name extends MemoryModel {
} }
_generateMemoryService(String name) { _generateMemoryService(String name) {
var lower = _snake(name);
return ''' return '''
import 'package:angel_framework/defs.dart'; import 'package:angel_framework/defs.dart';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import '../models/$lower.dart';
/// Store in-memory instances of this class. export '../models/$lower.dart';
class $name extends MemoryModel {
String name, desc;
$name({String id, this.name, this.desc}) {
this.id = id;
}
factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json));
factory $name.fromMap(Map data) => new $name(
id: data['id']
name: data['name'],
desc: data['desc']);
Map toJson() {
return {
'id': id,
'name': name,
'desc': desc
};
}
}
/// Manages [$name] in-memory. /// Manages [$name] in-memory.
class ${name}Service extends MemoryService<$name> { class ${name}Service extends MemoryService<$name> {
@ -201,7 +181,7 @@ class $name extends Model {
factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json)); factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json));
factory $name.fromMap(Map data) => new $name( factory $name.fromMap(Map data) => new $name(
id: data['id'] id: data['id'],
name: data['name'], name: data['name'],
desc: data['desc']); desc: data['desc']);

View file

@ -1,5 +1,5 @@
name: angel_cli name: angel_cli
version: 1.0.0-dev+8 version: 1.0.0-dev+9
description: Command-line tools for the Angel framework. description: Command-line tools for the Angel framework.
environment: environment:
sdk: ">=1.19.0" sdk: ">=1.19.0"