[Groonga-commit] groonga/groonga-admin at 667300f [master] Use more meaningful variable name for raw object

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Sep 23 12:25:17 JST 2016


YUKI Hiroshi	2016-09-23 12:25:17 +0900 (Fri, 23 Sep 2016)

  New Revision: 667300f583ebbd155dab4019e5b219cf00126987
  https://github.com/groonga/groonga-admin/commit/667300f583ebbd155dab4019e5b219cf00126987

  Merged 2dd9aa7: Merge pull request #11 from groonga/features/migrate-column_list-to-schema

  Message:
    Use more meaningful variable name for raw object

  Modified files:
    app/scripts/services/schema-loader.js

  Modified: app/scripts/services/schema-loader.js (+17 -13)
===================================================================
--- app/scripts/services/schema-loader.js    2016-09-21 19:21:05 +0900 (7b246dd)
+++ app/scripts/services/schema-loader.js    2016-09-23 12:25:17 +0900 (19dabf3)
@@ -184,7 +184,7 @@ angular.module('groongaAdminApp')
         });
       }
 
-      function buildColumn(table, rawColumn) {
+      function buildColumn(rawTable, rawColumn) {
         var column = {};
         column.id       = 0; // XXX it exists in a table_list response but missing in a schema response.
         column.name     = rawColumn.name;
@@ -192,7 +192,7 @@ angular.module('groongaAdminApp')
         column.type     = rawColumn.type;
         column.sizeType = rawColumn.type;
         column.sources  = rawColumn.sources.join('|'); // XXX what is the correct delimiter?
-        column.table    = table;
+        column.table    = rawTable;
 
         column.flags = [];
         if (rawColumn.command &&
@@ -200,38 +200,42 @@ angular.module('groongaAdminApp')
             rawColumn.command.arguments.flags)
           column.flags = rawColumn.command.arguments.flags.split('|');
 
-        column.valeuType = null;
-        if (column.value_type)
-          column.valueType = column.value_type.name;
+        column.valueType = null;
+        if (rawColumn.value_type)
+          column.valueType = {
+            name: rawColumn.value_type.name,
+            isTextType: isTextType(rawColumn.value_type.name),
+            isReferenceType: rawColumn.value_type.type == 'reference'
+          };
 
         column.isScalar = column.type == 'scalar';
         column.isVector = column.type == 'vector';
         column.isIndex  = column.type == 'index';
 
-        column.range  = column.valueType; // for backward compatibility
-        column.domain = table.name; // for backward compatibility
+        column.range  = column.valueType && column.valueType.name; // for backward compatibility
+        column.domain = rawTable.name; // for backward compatibility
         column.source = column.sources; // for backward compatibility
 
         column.indexes = [];
         return column;
       }
 
-      function buildColumns(table) {
+      function buildColumns(rawTable) {
         var columns = {};
 
         columns._id = {
           name:   '_id',
-          id:     table.id,
-          path:   table.path,
+          id:     rawTable.id || 0,
+          path:   rawTable.path || '',
           type:   'fix',
           flags:  ['COLUMN_SCALAR', 'PERSISTENT'],
-          domain: table.name,
+          domain: rawTable.name,
           range:  'UInt32',
           source: null
         };
 
-        angular.forEach(columns, function(column, name) {
-          columns[name] = buildColumn(table, column);
+        angular.forEach(rawTable.columns, function(rawColumn, name) {
+          columns[name] = buildColumn(rawTable, rawColumn);
         });
 
         return columns;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index