-
Notifications
You must be signed in to change notification settings - Fork 132
feat: PostgreSQL dialect databases #1673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
d3708f3
8d7e306
9a13a30
1a29444
2ad51ec
ce5d0e8
671e3aa
b93b1a9
5318ec4
d73bbc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html --> | ||
<differences> | ||
8001: com.google.cloud.spanner.connection.StatementParser: Class com.google.cloud.spanner.connection.StatementParser removed | ||
<difference> | ||
<differenceType>7012</differenceType> | ||
<className>com/google/cloud/spanner/connection/Connection</className> | ||
<method>com.google.cloud.spanner.Dialect getDialect()</method> | ||
</difference> | ||
<difference> | ||
<differenceType>8001</differenceType> | ||
<className>com/google/cloud/spanner/connection/StatementParser</className> | ||
</difference> | ||
</differences> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,10 @@ public Builder setDefaultLeader(String defaultLeader) { | |
throw new UnsupportedOperationException("Unimplemented"); | ||
} | ||
|
||
public Builder setDialect(Dialect dialect) { | ||
throw new UnsupportedOperationException("Unimplemented"); | ||
} | ||
|
||
abstract Builder setProto(com.google.spanner.admin.database.v1.Database proto); | ||
|
||
/** Builds the database from this builder. */ | ||
|
@@ -69,6 +73,7 @@ abstract static class BuilderImpl extends Builder { | |
private Timestamp earliestVersionTime; | ||
private CustomerManagedEncryption encryptionConfig; | ||
private String defaultLeader; | ||
private Dialect dialect = Dialect.GOOGLE_STANDARD_SQL; | ||
private com.google.spanner.admin.database.v1.Database proto; | ||
|
||
BuilderImpl(DatabaseId id) { | ||
|
@@ -84,6 +89,7 @@ abstract static class BuilderImpl extends Builder { | |
this.earliestVersionTime = other.earliestVersionTime; | ||
this.encryptionConfig = other.encryptionConfig; | ||
this.defaultLeader = other.defaultLeader; | ||
this.dialect = other.dialect; | ||
this.proto = other.proto; | ||
} | ||
|
||
|
@@ -129,6 +135,12 @@ public Builder setDefaultLeader(String defaultLeader) { | |
return this; | ||
} | ||
|
||
@Override | ||
public Builder setDialect(Dialect dialect) { | ||
this.dialect = dialect; | ||
return this; | ||
} | ||
|
||
@Override | ||
Builder setProto(@Nullable com.google.spanner.admin.database.v1.Database proto) { | ||
this.proto = proto; | ||
|
@@ -156,6 +168,7 @@ public enum State { | |
private final Timestamp earliestVersionTime; | ||
private final CustomerManagedEncryption encryptionConfig; | ||
private final String defaultLeader; | ||
private final Dialect dialect; | ||
private final com.google.spanner.admin.database.v1.Database proto; | ||
|
||
public DatabaseInfo(DatabaseId id, State state) { | ||
|
@@ -167,6 +180,7 @@ public DatabaseInfo(DatabaseId id, State state) { | |
this.earliestVersionTime = null; | ||
this.encryptionConfig = null; | ||
this.defaultLeader = null; | ||
this.dialect = null; | ||
this.proto = null; | ||
} | ||
|
||
|
@@ -179,6 +193,7 @@ public DatabaseInfo(DatabaseId id, State state) { | |
this.earliestVersionTime = builder.earliestVersionTime; | ||
this.encryptionConfig = builder.encryptionConfig; | ||
this.defaultLeader = builder.defaultLeader; | ||
this.dialect = builder.dialect; | ||
this.proto = builder.proto; | ||
} | ||
|
||
|
@@ -239,6 +254,14 @@ public Timestamp getEarliestVersionTime() { | |
return defaultLeader; | ||
} | ||
|
||
/** | ||
* The dialect that is used by the database. It can be one of the values as specified in {@link | ||
* Dialect#values()}. | ||
*/ | ||
public @Nullable Dialect getDialect() { | ||
return dialect; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it ever be null? Maybe we can say if null return UNSPECIFIED or GOOGLE_SQL_STANDARD? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
|
||
/** Returns the raw proto instance that was used to construct this {@link Database}. */ | ||
public @Nullable com.google.spanner.admin.database.v1.Database getProto() { | ||
return proto; | ||
|
@@ -260,7 +283,8 @@ public boolean equals(Object o) { | |
&& Objects.equals(versionRetentionPeriod, that.versionRetentionPeriod) | ||
&& Objects.equals(earliestVersionTime, that.earliestVersionTime) | ||
&& Objects.equals(encryptionConfig, that.encryptionConfig) | ||
&& Objects.equals(defaultLeader, that.defaultLeader); | ||
&& Objects.equals(defaultLeader, that.defaultLeader) | ||
&& Objects.equals(dialect, that.dialect); | ||
} | ||
|
||
@Override | ||
|
@@ -273,20 +297,22 @@ public int hashCode() { | |
versionRetentionPeriod, | ||
earliestVersionTime, | ||
encryptionConfig, | ||
defaultLeader); | ||
defaultLeader, | ||
dialect); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format( | ||
"Database[%s, %s, %s, %s, %s, %s, %s, %s]", | ||
"Database[%s, %s, %s, %s, %s, %s, %s, %s, %s]", | ||
id.getName(), | ||
state, | ||
createTime, | ||
restoreInfo, | ||
versionRetentionPeriod, | ||
earliestVersionTime, | ||
encryptionConfig, | ||
defaultLeader); | ||
defaultLeader, | ||
dialect); | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.