Skip to content

Commit

Permalink
Refactor EncryptDistSQLStatementVisitor (#28693)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Oct 9, 2023
1 parent 05d088e commit 8bd425c
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ public ASTNode visitEncryptRuleDefinition(final EncryptRuleDefinitionContext ctx

@Override
public ASTNode visitEncryptColumnDefinition(final EncryptColumnDefinitionContext ctx) {
return new EncryptColumnSegment(getIdentifierValue(ctx.columnDefinition().columnName()),
new EncryptColumnItemSegment(getIdentifierValue(ctx.cipherColumnDefinition().cipherColumnName()), (AlgorithmSegment) visit(ctx.encryptAlgorithm().algorithmDefinition())),
null == ctx.assistedQueryColumnDefinition() ? null
: new EncryptColumnItemSegment(getIdentifierValue(ctx.assistedQueryColumnDefinition().assistedQueryColumnName()), getAssistedEncryptor(ctx)),
null == ctx.likeQueryColumnDefinition() ? null : new EncryptColumnItemSegment(getIdentifierValue(ctx.likeQueryColumnDefinition().likeQueryColumnName()), getLikeEncryptor(ctx)));
EncryptColumnItemSegment cipher = new EncryptColumnItemSegment(
getIdentifierValue(ctx.cipherColumnDefinition().cipherColumnName()), (AlgorithmSegment) visit(ctx.encryptAlgorithm().algorithmDefinition()));
EncryptColumnItemSegment assistedQuery = null == ctx.assistedQueryColumnDefinition()
? null
: new EncryptColumnItemSegment(getIdentifierValue(ctx.assistedQueryColumnDefinition().assistedQueryColumnName()), getAssistedEncryptor(ctx));
EncryptColumnItemSegment likeQuery = null == ctx.likeQueryColumnDefinition()
? null
: new EncryptColumnItemSegment(getIdentifierValue(ctx.likeQueryColumnDefinition().likeQueryColumnName()), getLikeEncryptor(ctx));
return new EncryptColumnSegment(getIdentifierValue(ctx.columnDefinition().columnName()), cipher, assistedQuery, likeQuery);
}

private AlgorithmSegment getAssistedEncryptor(final EncryptColumnDefinitionContext ctx) {
Expand Down

0 comments on commit 8bd425c

Please sign in to comment.