@Test public void testUpdated() { HashMap<String, Object> before = new HashMap<>(); before.put("1", 1); before.put("2", "22"); before.put("3", "33".getBytes()); before.put("4", 4L); before.put("5", new Timestamp(System.currentTimeMillis())); before.put("6", "中文".getBytes(StandardCharsets.UTF_8)); before.put("7", "中文".getBytes(StandardCharsets.UTF_8)); before.put("8", 1.1); before.put("9", new BigDecimal("10000.1")); before.put("10", new BigDecimal("10000.1")); before.put("11", new Date(System.currentTimeMillis())); HashMap<String, Object> now = new HashMap<>(); now.put("1", 1); now.put("2", "2"); now.put("3", "3".getBytes()); now.put("4", 4L); now.put("5", new Timestamp(System.currentTimeMillis() + 1000)); now.put("6", "中文".getBytes(StandardCharsets.UTF_8)); now.put("7", "中文啊".getBytes(StandardCharsets.UTF_8)); now.put("8", 1.10); now.put("9", new BigDecimal("10000.10001")); now.put("10", new BigDecimal("10000.10000")); now.put("11", new Date(System.currentTimeMillis() + _1D)); NamedFullRow row = new NamedFullRow(now).setBeforeFull(before); SyncData data = new SyncData(new BinlogDataId("mysql-bin.00001", 4, 10), SimpleEventType.UPDATE, "test", "test", "id", 1L, row); assertTrue(data.updated()); assertTrue(!data.updated("1")); assertTrue(data.updated("2")); assertTrue(data.updated("3")); assertTrue(!data.updated("4")); assertTrue(data.updated("5")); assertTrue(!data.updated("6")); assertTrue(data.updated("7")); assertTrue(!data.updated("8")); assertTrue(data.updated("9")); assertTrue(data.updated("10")); assertTrue(data.updated("11")); }
@Override public boolean updated() { return updated != null; }
SyncData implements com.github.zzt93.syncer.data.SyncData, Serializable { @Override public boolean updated() { return updated != null; } }
SyncData implements com.github.zzt93.syncer.data.SyncData, Serializable { @Override public boolean updated() { return updated != null; } SyncData(DataId dataId, SimpleEventType type, String database, String entity, String primaryKeyName,
                  Object id, NamedChange row); private  SyncData(DataId dataId, SimpleEventType type, String database, String entity, String primaryKeyName, Object id,
                             HashMap<String, Object> full, HashMap<String, Object> beforeFull, Set<String> updated);  SyncData(SyncData syncData, int offset); }
SyncData implements com.github.zzt93.syncer.data.SyncData, Serializable { @Override public boolean updated() { return updated != null; } SyncData(DataId dataId, SimpleEventType type, String database, String entity, String primaryKeyName,
                  Object id, NamedChange row); private  SyncData(DataId dataId, SimpleEventType type, String database, String entity, String primaryKeyName, Object id,
                             HashMap<String, Object> full, HashMap<String, Object> beforeFull, Set<String> updated);  SyncData(SyncData syncData, int offset); @Override Object getId(); @Override SyncData setId(Object id); @Override String getEntity(); @Override SyncData setEntity(String entity); @Override boolean isWrite(); @Override boolean isUpdate(); @Override boolean isDelete(); @Override SyncData toWrite(); @Override SyncData toUpdate(); @Override SyncData toDelete(); @Override String getRepo(); @Override SyncData setRepo(String repo); @Override Object getExtra(String key); @Override com.github.zzt93.syncer.data.SyncData copyMeta(int index); @Override boolean updated(); @Override boolean updated(String key); @Override Set<String> getUpdated(); @Override Object getBefore(String key); @Override HashMap<String, Object> getBefore(); @Override SyncData addExtra(String key, Object value); SyncData addField(String key, Object value); @Override SyncData setFieldNull(String key); SyncData renameField(String oldKey, String newKey); Object removeField(String key); boolean removePrimaryKey(); SyncData removeFields(String... keys); boolean containField(String key); SyncData updateField(String key, Object value); StandardEvaluationContext getContext(); void setContext(StandardEvaluationContext context); void recycleParseContext(ThreadLocal<StandardEvaluationContext> contexts); @Override HashMap<String, Object> getFields(); @Override HashMap<String, Object> getExtras(); Object getField(String key); @Override Long getFieldAsLong(String key); @Override Integer getFieldAInt(String key); String getEventId(); DataId getDataId(); String getSourceIdentifier(); SyncData setSourceIdentifier(String identifier); HashMap<String, Object> getSyncBy(); SyncByQuery syncByQuery(); ESScriptUpdate esScriptUpdate(); @Override ESScriptUpdate esScriptUpdate(String script, Map<String, Object> params); @Override ESScriptUpdate esScriptUpdate(Filter docFilter); ESScriptUpdate getEsScriptUpdate(); ExtraQuery extraQuery(String indexName, String typeName); ExtraQueryContext getExtraQueryContext(); boolean hasExtra(); SimpleEventType getType(); SyncResult getResult(); SyncData copy(); Long getPartitionId(); void setPartitionField(String fieldName); }
SyncData implements com.github.zzt93.syncer.data.SyncData, Serializable { @Override public boolean updated() { return updated != null; } SyncData(DataId dataId, SimpleEventType type, String database, String entity, String primaryKeyName,
                  Object id, NamedChange row); private  SyncData(DataId dataId, SimpleEventType type, String database, String entity, String primaryKeyName, Object id,
                             HashMap<String, Object> full, HashMap<String, Object> beforeFull, Set<String> updated);  SyncData(SyncData syncData, int offset); @Override Object getId(); @Override SyncData setId(Object id); @Override String getEntity(); @Override SyncData setEntity(String entity); @Override boolean isWrite(); @Override boolean isUpdate(); @Override boolean isDelete(); @Override SyncData toWrite(); @Override SyncData toUpdate(); @Override SyncData toDelete(); @Override String getRepo(); @Override SyncData setRepo(String repo); @Override Object getExtra(String key); @Override com.github.zzt93.syncer.data.SyncData copyMeta(int index); @Override boolean updated(); @Override boolean updated(String key); @Override Set<String> getUpdated(); @Override Object getBefore(String key); @Override HashMap<String, Object> getBefore(); @Override SyncData addExtra(String key, Object value); SyncData addField(String key, Object value); @Override SyncData setFieldNull(String key); SyncData renameField(String oldKey, String newKey); Object removeField(String key); boolean removePrimaryKey(); SyncData removeFields(String... keys); boolean containField(String key); SyncData updateField(String key, Object value); StandardEvaluationContext getContext(); void setContext(StandardEvaluationContext context); void recycleParseContext(ThreadLocal<StandardEvaluationContext> contexts); @Override HashMap<String, Object> getFields(); @Override HashMap<String, Object> getExtras(); Object getField(String key); @Override Long getFieldAsLong(String key); @Override Integer getFieldAInt(String key); String getEventId(); DataId getDataId(); String getSourceIdentifier(); SyncData setSourceIdentifier(String identifier); HashMap<String, Object> getSyncBy(); SyncByQuery syncByQuery(); ESScriptUpdate esScriptUpdate(); @Override ESScriptUpdate esScriptUpdate(String script, Map<String, Object> params); @Override ESScriptUpdate esScriptUpdate(Filter docFilter); ESScriptUpdate getEsScriptUpdate(); ExtraQuery extraQuery(String indexName, String typeName); ExtraQueryContext getExtraQueryContext(); boolean hasExtra(); SimpleEventType getType(); SyncResult getResult(); SyncData copy(); Long getPartitionId(); void setPartitionField(String fieldName);  }