Skip to content

Commit fe7fc2a

Browse files
authored
feat: expose isStored on column (#177)
1 parent 0b31312 commit fe7fc2a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTcolumn_def.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public boolean isHidden() {
6262
return AstTreeUtils.getOptionalChildByType(children, ASThidden.class) != null;
6363
}
6464

65+
public boolean isStored() {
66+
return getGenerationClause() != null && getGenerationClause().isStored();
67+
}
68+
6569
@Override
6670
public String toString() {
6771
// check for unknown/unsupported children

src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTgeneration_clause.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ public ASTgeneration_clause(DdlParser p, int id) {
2525
super(p, id);
2626
}
2727

28+
public boolean isStored() {
29+
return children.length > 1 && children[1].getClass() == ASTstored.class;
30+
}
31+
2832
@Override
2933
public String toString() {
3034
final ASTexpression exp = (ASTexpression) children[0];
31-
final String storedOpt =
32-
children.length > 1 && children[1].getClass() == ASTstored.class ? " STORED" : "";
35+
final String storedOpt = isStored() ? " STORED" : "";
3336
return "AS ( " + exp.toString() + " )" + storedOpt;
3437
}
3538

0 commit comments

Comments
 (0)