feature:support auto sync project document by cron task (#3)

* feat: auto sync project document by cron task

* feat:update README
This commit is contained in:
vran
2022-01-25 23:48:34 +08:00
committed by GitHub
parent 1c909cbeda
commit 604cb4ab47
20 changed files with 492 additions and 44 deletions

View File

@@ -72,12 +72,12 @@ public class Login extends TableImpl<LoginRecord> {
/**
* The column <code>databasir.login.access_token_expire_at</code>.
*/
public final TableField<LoginRecord, LocalDateTime> ACCESS_TOKEN_EXPIRE_AT = createField(DSL.name("access_token_expire_at"), SQLDataType.LOCALDATETIME(0).nullable(false), this, "");
public final TableField<LoginRecord, LocalDateTime> ACCESS_TOKEN_EXPIRE_AT = createField(DSL.name("access_token_expire_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
/**
* The column <code>databasir.login.refresh_token_expire_at</code>.
*/
public final TableField<LoginRecord, LocalDateTime> REFRESH_TOKEN_EXPIRE_AT = createField(DSL.name("refresh_token_expire_at"), SQLDataType.LOCALDATETIME(0).nullable(false), this, "");
public final TableField<LoginRecord, LocalDateTime> REFRESH_TOKEN_EXPIRE_AT = createField(DSL.name("refresh_token_expire_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
/**
* The column <code>databasir.login.update_at</code>.

View File

@@ -18,7 +18,7 @@ import org.jooq.Identity;
import org.jooq.JSON;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row6;
import org.jooq.Row8;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
@@ -72,6 +72,16 @@ public class ProjectSyncRule extends TableImpl<ProjectSyncRuleRecord> {
*/
public final TableField<ProjectSyncRuleRecord, JSON> IGNORE_COLUMN_NAME_REGEX_ARRAY = createField(DSL.name("ignore_column_name_regex_array"), SQLDataType.JSON.nullable(false), this, "");
/**
* The column <code>databasir.project_sync_rule.is_auto_sync</code>.
*/
public final TableField<ProjectSyncRuleRecord, Boolean> IS_AUTO_SYNC = createField(DSL.name("is_auto_sync"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.inline("0", SQLDataType.BOOLEAN)), this, "");
/**
* The column <code>databasir.project_sync_rule.auto_sync_cron</code>.
*/
public final TableField<ProjectSyncRuleRecord, String> AUTO_SYNC_CRON = createField(DSL.name("auto_sync_cron"), SQLDataType.VARCHAR(128).nullable(false).defaultValue(DSL.inline("", SQLDataType.VARCHAR)), this, "");
/**
* The column <code>databasir.project_sync_rule.update_at</code>.
*/
@@ -164,11 +174,11 @@ public class ProjectSyncRule extends TableImpl<ProjectSyncRuleRecord> {
}
// -------------------------------------------------------------------------
// Row6 type methods
// Row8 type methods
// -------------------------------------------------------------------------
@Override
public Row6<Integer, Integer, JSON, JSON, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row6) super.fieldsRow();
public Row8<Integer, Integer, JSON, JSON, Boolean, String, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row8) super.fieldsRow();
}
}

View File

@@ -22,6 +22,8 @@ public class ProjectSyncRulePojo implements Serializable {
private Integer projectId;
private JSON ignoreTableNameRegexArray;
private JSON ignoreColumnNameRegexArray;
private Boolean isAutoSync;
private String autoSyncCron;
private LocalDateTime updateAt;
private LocalDateTime createAt;
@@ -32,6 +34,8 @@ public class ProjectSyncRulePojo implements Serializable {
this.projectId = value.projectId;
this.ignoreTableNameRegexArray = value.ignoreTableNameRegexArray;
this.ignoreColumnNameRegexArray = value.ignoreColumnNameRegexArray;
this.isAutoSync = value.isAutoSync;
this.autoSyncCron = value.autoSyncCron;
this.updateAt = value.updateAt;
this.createAt = value.createAt;
}
@@ -41,6 +45,8 @@ public class ProjectSyncRulePojo implements Serializable {
Integer projectId,
JSON ignoreTableNameRegexArray,
JSON ignoreColumnNameRegexArray,
Boolean isAutoSync,
String autoSyncCron,
LocalDateTime updateAt,
LocalDateTime createAt
) {
@@ -48,6 +54,8 @@ public class ProjectSyncRulePojo implements Serializable {
this.projectId = projectId;
this.ignoreTableNameRegexArray = ignoreTableNameRegexArray;
this.ignoreColumnNameRegexArray = ignoreColumnNameRegexArray;
this.isAutoSync = isAutoSync;
this.autoSyncCron = autoSyncCron;
this.updateAt = updateAt;
this.createAt = createAt;
}
@@ -112,6 +120,34 @@ public class ProjectSyncRulePojo implements Serializable {
this.ignoreColumnNameRegexArray = ignoreColumnNameRegexArray;
}
/**
* Getter for <code>databasir.project_sync_rule.is_auto_sync</code>.
*/
public Boolean getIsAutoSync() {
return this.isAutoSync;
}
/**
* Setter for <code>databasir.project_sync_rule.is_auto_sync</code>.
*/
public void setIsAutoSync(Boolean isAutoSync) {
this.isAutoSync = isAutoSync;
}
/**
* Getter for <code>databasir.project_sync_rule.auto_sync_cron</code>.
*/
public String getAutoSyncCron() {
return this.autoSyncCron;
}
/**
* Setter for <code>databasir.project_sync_rule.auto_sync_cron</code>.
*/
public void setAutoSyncCron(String autoSyncCron) {
this.autoSyncCron = autoSyncCron;
}
/**
* Getter for <code>databasir.project_sync_rule.update_at</code>.
*/
@@ -148,6 +184,8 @@ public class ProjectSyncRulePojo implements Serializable {
sb.append(", ").append(projectId);
sb.append(", ").append(ignoreTableNameRegexArray);
sb.append(", ").append(ignoreColumnNameRegexArray);
sb.append(", ").append(isAutoSync);
sb.append(", ").append(autoSyncCron);
sb.append(", ").append(updateAt);
sb.append(", ").append(createAt);

View File

@@ -12,8 +12,8 @@ import java.time.LocalDateTime;
import org.jooq.Field;
import org.jooq.JSON;
import org.jooq.Record1;
import org.jooq.Record6;
import org.jooq.Row6;
import org.jooq.Record8;
import org.jooq.Row8;
import org.jooq.impl.UpdatableRecordImpl;
@@ -21,7 +21,7 @@ import org.jooq.impl.UpdatableRecordImpl;
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRecord> implements Record6<Integer, Integer, JSON, JSON, LocalDateTime, LocalDateTime> {
public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRecord> implements Record8<Integer, Integer, JSON, JSON, Boolean, String, LocalDateTime, LocalDateTime> {
private static final long serialVersionUID = 1L;
@@ -85,32 +85,60 @@ public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRe
return (JSON) get(3);
}
/**
* Setter for <code>databasir.project_sync_rule.is_auto_sync</code>.
*/
public void setIsAutoSync(Boolean value) {
set(4, value);
}
/**
* Getter for <code>databasir.project_sync_rule.is_auto_sync</code>.
*/
public Boolean getIsAutoSync() {
return (Boolean) get(4);
}
/**
* Setter for <code>databasir.project_sync_rule.auto_sync_cron</code>.
*/
public void setAutoSyncCron(String value) {
set(5, value);
}
/**
* Getter for <code>databasir.project_sync_rule.auto_sync_cron</code>.
*/
public String getAutoSyncCron() {
return (String) get(5);
}
/**
* Setter for <code>databasir.project_sync_rule.update_at</code>.
*/
public void setUpdateAt(LocalDateTime value) {
set(4, value);
set(6, value);
}
/**
* Getter for <code>databasir.project_sync_rule.update_at</code>.
*/
public LocalDateTime getUpdateAt() {
return (LocalDateTime) get(4);
return (LocalDateTime) get(6);
}
/**
* Setter for <code>databasir.project_sync_rule.create_at</code>.
*/
public void setCreateAt(LocalDateTime value) {
set(5, value);
set(7, value);
}
/**
* Getter for <code>databasir.project_sync_rule.create_at</code>.
*/
public LocalDateTime getCreateAt() {
return (LocalDateTime) get(5);
return (LocalDateTime) get(7);
}
// -------------------------------------------------------------------------
@@ -123,17 +151,17 @@ public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRe
}
// -------------------------------------------------------------------------
// Record6 type implementation
// Record8 type implementation
// -------------------------------------------------------------------------
@Override
public Row6<Integer, Integer, JSON, JSON, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row6) super.fieldsRow();
public Row8<Integer, Integer, JSON, JSON, Boolean, String, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row8) super.fieldsRow();
}
@Override
public Row6<Integer, Integer, JSON, JSON, LocalDateTime, LocalDateTime> valuesRow() {
return (Row6) super.valuesRow();
public Row8<Integer, Integer, JSON, JSON, Boolean, String, LocalDateTime, LocalDateTime> valuesRow() {
return (Row8) super.valuesRow();
}
@Override
@@ -157,12 +185,22 @@ public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRe
}
@Override
public Field<LocalDateTime> field5() {
public Field<Boolean> field5() {
return ProjectSyncRule.PROJECT_SYNC_RULE.IS_AUTO_SYNC;
}
@Override
public Field<String> field6() {
return ProjectSyncRule.PROJECT_SYNC_RULE.AUTO_SYNC_CRON;
}
@Override
public Field<LocalDateTime> field7() {
return ProjectSyncRule.PROJECT_SYNC_RULE.UPDATE_AT;
}
@Override
public Field<LocalDateTime> field6() {
public Field<LocalDateTime> field8() {
return ProjectSyncRule.PROJECT_SYNC_RULE.CREATE_AT;
}
@@ -187,12 +225,22 @@ public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRe
}
@Override
public LocalDateTime component5() {
public Boolean component5() {
return getIsAutoSync();
}
@Override
public String component6() {
return getAutoSyncCron();
}
@Override
public LocalDateTime component7() {
return getUpdateAt();
}
@Override
public LocalDateTime component6() {
public LocalDateTime component8() {
return getCreateAt();
}
@@ -217,12 +265,22 @@ public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRe
}
@Override
public LocalDateTime value5() {
public Boolean value5() {
return getIsAutoSync();
}
@Override
public String value6() {
return getAutoSyncCron();
}
@Override
public LocalDateTime value7() {
return getUpdateAt();
}
@Override
public LocalDateTime value6() {
public LocalDateTime value8() {
return getCreateAt();
}
@@ -251,25 +309,39 @@ public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRe
}
@Override
public ProjectSyncRuleRecord value5(LocalDateTime value) {
public ProjectSyncRuleRecord value5(Boolean value) {
setIsAutoSync(value);
return this;
}
@Override
public ProjectSyncRuleRecord value6(String value) {
setAutoSyncCron(value);
return this;
}
@Override
public ProjectSyncRuleRecord value7(LocalDateTime value) {
setUpdateAt(value);
return this;
}
@Override
public ProjectSyncRuleRecord value6(LocalDateTime value) {
public ProjectSyncRuleRecord value8(LocalDateTime value) {
setCreateAt(value);
return this;
}
@Override
public ProjectSyncRuleRecord values(Integer value1, Integer value2, JSON value3, JSON value4, LocalDateTime value5, LocalDateTime value6) {
public ProjectSyncRuleRecord values(Integer value1, Integer value2, JSON value3, JSON value4, Boolean value5, String value6, LocalDateTime value7, LocalDateTime value8) {
value1(value1);
value2(value2);
value3(value3);
value4(value4);
value5(value5);
value6(value6);
value7(value7);
value8(value8);
return this;
}
@@ -287,13 +359,15 @@ public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRe
/**
* Create a detached, initialised ProjectSyncRuleRecord
*/
public ProjectSyncRuleRecord(Integer id, Integer projectId, JSON ignoreTableNameRegexArray, JSON ignoreColumnNameRegexArray, LocalDateTime updateAt, LocalDateTime createAt) {
public ProjectSyncRuleRecord(Integer id, Integer projectId, JSON ignoreTableNameRegexArray, JSON ignoreColumnNameRegexArray, Boolean isAutoSync, String autoSyncCron, LocalDateTime updateAt, LocalDateTime createAt) {
super(ProjectSyncRule.PROJECT_SYNC_RULE);
setId(id);
setProjectId(projectId);
setIgnoreTableNameRegexArray(ignoreTableNameRegexArray);
setIgnoreColumnNameRegexArray(ignoreColumnNameRegexArray);
setIsAutoSync(isAutoSync);
setAutoSyncCron(autoSyncCron);
setUpdateAt(updateAt);
setCreateAt(createAt);
}
@@ -309,6 +383,8 @@ public class ProjectSyncRuleRecord extends UpdatableRecordImpl<ProjectSyncRuleRe
setProjectId(value.getProjectId());
setIgnoreTableNameRegexArray(value.getIgnoreTableNameRegexArray());
setIgnoreColumnNameRegexArray(value.getIgnoreColumnNameRegexArray());
setIsAutoSync(value.getIsAutoSync());
setAutoSyncCron(value.getAutoSyncCron());
setUpdateAt(value.getUpdateAt());
setCreateAt(value.getCreateAt());
}