本文整理了Java中org.jooq.TableField.cast()
方法的一些代码示例,展示了TableField.cast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableField.cast()
方法的具体详情如下:
包路径:org.jooq.TableField
类名称:TableField
方法名:cast
暂无
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public OrganizationEntry get(UUID id) {
try (DSLContext tx = DSL.using(cfg)) {
return tx.select(ORGANIZATIONS.ORG_ID, ORGANIZATIONS.ORG_NAME, ORGANIZATIONS.VISIBILITY,
ORGANIZATIONS.META.cast(String.class), ORGANIZATIONS.ORG_CFG.cast(String.class))
.from(ORGANIZATIONS)
.where(ORGANIZATIONS.ORG_ID.eq(id))
.fetchOne(this::toEntry);
}
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public OrganizationEntry getByName(String name) {
try (DSLContext tx = DSL.using(cfg)) {
return tx.select(ORGANIZATIONS.ORG_ID, ORGANIZATIONS.ORG_NAME, ORGANIZATIONS.VISIBILITY,
ORGANIZATIONS.META.cast(String.class), ORGANIZATIONS.ORG_CFG.cast(String.class))
.from(ORGANIZATIONS)
.where(ORGANIZATIONS.ORG_NAME.eq(name))
.fetchOne(this::toEntry);
}
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public List<PolicyEntry> list() {
try (DSLContext tx = DSL.using(cfg)) {
return tx.select(POLICIES.POLICY_ID,
POLICIES.PARENT_POLICY_ID,
POLICIES.POLICY_NAME,
POLICIES.RULES.cast(String.class))
.from(POLICIES)
.fetch(this::toEntry);
}
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
private static SelectJoinStep<Record11<UUID, UUID, String, String, String, String, String, String, UUID, String, String>> selectRepositoryEntry(DSLContext tx) {
return tx.select(REPOSITORIES.REPO_ID,
REPOSITORIES.PROJECT_ID,
REPOSITORIES.REPO_NAME,
REPOSITORIES.REPO_URL,
REPOSITORIES.REPO_BRANCH,
REPOSITORIES.REPO_COMMIT_ID,
REPOSITORIES.REPO_PATH,
REPOSITORIES.META.cast(String.class),
SECRETS.SECRET_ID,
SECRETS.SECRET_NAME,
SECRETS.STORE_TYPE)
.from(REPOSITORIES)
.leftOuterJoin(SECRETS).on(SECRETS.SECRET_ID.eq(REPOSITORIES.SECRET_ID));
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public PolicyEntry get(UUID policyId) {
try (DSLContext tx = DSL.using(cfg)) {
return tx.select(POLICIES.POLICY_ID,
POLICIES.PARENT_POLICY_ID,
POLICIES.POLICY_NAME,
POLICIES.RULES.cast(String.class))
.from(POLICIES)
.where(POLICIES.POLICY_ID.eq(policyId))
.fetchOne(this::toEntry);
}
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public List<Map<String,Object>> list(UUID inventoryId) {
try (DSLContext tx = DSL.using(cfg)) {
return tx.select(INVENTORY_DATA.ITEM_PATH, INVENTORY_DATA.ITEM_DATA.cast(String.class))
.from(INVENTORY_DATA)
.where(INVENTORY_DATA.INVENTORY_ID.eq(inventoryId))
.fetch(this::toListItem);
}
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
private SelectJoinStep<Record12<UUID, UUID, String, UUID, String, UUID, String, String, String[], String, String, String>> selectTriggers(DSLContext tx) {
Organizations o = ORGANIZATIONS.as("o");
Projects p = PROJECTS.as("p");
Repositories r = REPOSITORIES.as("r");
return tx.select(
TRIGGERS.TRIGGER_ID,
o.ORG_ID,
o.ORG_NAME,
TRIGGERS.PROJECT_ID,
p.PROJECT_NAME,
TRIGGERS.REPO_ID,
r.REPO_NAME,
TRIGGERS.EVENT_SOURCE,
TRIGGERS.ACTIVE_PROFILES,
TRIGGERS.ARGUMENTS.cast(String.class),
TRIGGERS.CONDITIONS.cast(String.class),
TRIGGERS.TRIGGER_CFG.cast(String.class))
.from(TRIGGERS)
.leftJoin(p).on(p.PROJECT_ID.eq(TRIGGERS.PROJECT_ID))
.leftJoin(o).on(o.ORG_ID.eq(p.ORG_ID))
.leftJoin(r).on(r.REPO_ID.eq(TRIGGERS.REPO_ID));
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
@SuppressWarnings("unchecked")
public Map<String, Object> getConfiguration(UUID orgId) {
try (DSLContext tx = DSL.using(cfg)) {
return tx.select(ORGANIZATIONS.ORG_CFG.cast(String.class))
.from(ORGANIZATIONS)
.where(ORGANIZATIONS.ORG_ID.eq(orgId))
.fetchOne(e -> deserialize(e.value1()));
}
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
@SuppressWarnings("unchecked")
public Map<String, Object> getConfiguration(UUID projectId) {
try (DSLContext tx = DSL.using(cfg)) {
return tx.select(PROJECTS.PROJECT_CFG.cast(String.class))
.from(PROJECTS)
.where(PROJECTS.PROJECT_ID.eq(projectId))
.fetchOne(e -> deserialize(e.value1()));
}
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public List<OrganizationEntry> list(UUID userId) {
try (DSLContext tx = DSL.using(cfg)) {
SelectJoinStep<Record5<UUID, String, String, String, String>> q = tx.select(ORGANIZATIONS.ORG_ID,
ORGANIZATIONS.ORG_NAME,
ORGANIZATIONS.VISIBILITY,
ORGANIZATIONS.META.cast(String.class),
ORGANIZATIONS.ORG_CFG.cast(String.class))
.from(ORGANIZATIONS);
if (userId != null) {
SelectConditionStep<Record1<UUID>> teamIds = selectDistinct(USER_TEAMS.TEAM_ID)
.from(USER_TEAMS)
.where(USER_TEAMS.USER_ID.eq(userId));
SelectConditionStep<Record1<UUID>> orgIds = selectDistinct(TEAMS.ORG_ID)
.from(TEAMS)
.where(TEAMS.TEAM_ID.in(teamIds));
q.where(ORGANIZATIONS.ORG_ID.in(orgIds));
}
return q.orderBy(ORGANIZATIONS.ORG_NAME)
.fetch(this::toEntry);
}
}
代码示例来源:origin: org.jooq/jooq-meta
@Override
protected List<TableDefinition> getTables0() throws SQLException {
List<TableDefinition> result = new ArrayList<TableDefinition>();
for (Record record : create().select(
Sysschemas.SCHEMANAME,
Systables.TABLENAME,
Systables.TABLEID)
.from(SYSTABLES)
.join(SYSSCHEMAS)
.on(Systables.SCHEMAID.equal(Sysschemas.SCHEMAID))
// [#6797] The cast is necessary if a non-standard collation is used
.where(Sysschemas.SCHEMANAME.cast(VARCHAR(32672)).in(getInputSchemata()))
.orderBy(
Sysschemas.SCHEMANAME,
Systables.TABLENAME)
.fetch()) {
SchemaDefinition schema = getSchema(record.get(Sysschemas.SCHEMANAME));
String name = record.get(Systables.TABLENAME);
String id = record.get(Systables.TABLEID);
DerbyTableDefinition table = new DerbyTableDefinition(schema, name, id);
result.add(table);
}
return result;
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
private RepositoryEntry toEntry(Record11<UUID, UUID, String, String, String, String, String, String, UUID, String, String> r) {
return new RepositoryEntry(r.get(REPOSITORIES.REPO_ID),
r.get(REPOSITORIES.PROJECT_ID),
r.get(REPOSITORIES.REPO_NAME),
r.get(REPOSITORIES.REPO_URL),
r.get(REPOSITORIES.REPO_BRANCH),
r.get(REPOSITORIES.REPO_COMMIT_ID),
r.get(REPOSITORIES.REPO_PATH),
r.get(SECRETS.SECRET_ID),
r.get(SECRETS.SECRET_NAME),
r.get(SECRETS.STORE_TYPE),
deserialize(r.get(REPOSITORIES.META.cast(String.class))));
}
代码示例来源:origin: org.jooq/jooq-meta
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<SequenceDefinition>();
for (Record record : create().select(
Sysschemas.SCHEMANAME,
Syssequences.SEQUENCENAME,
Syssequences.SEQUENCEDATATYPE)
.from(SYSSEQUENCES)
.join(SYSSCHEMAS)
.on(Sysschemas.SCHEMAID.equal(Syssequences.SCHEMAID))
// [#6797] The cast is necessary if a non-standard collation is used
.where(Sysschemas.SCHEMANAME.cast(VARCHAR(32672)).in(getInputSchemata()))
.orderBy(
Sysschemas.SCHEMANAME,
Syssequences.SEQUENCENAME)
.fetch()) {
SchemaDefinition schema = getSchema(record.get(Sysschemas.SCHEMANAME));
DataTypeDefinition type = new DefaultDataTypeDefinition(
this,
schema,
record.get(Syssequences.SEQUENCEDATATYPE)
);
result.add(new DefaultSequenceDefinition(
schema,
record.get(Syssequences.SEQUENCENAME, String.class),
type));
}
return result;
}
代码示例来源:origin: org.jooq/jooq-meta
private Result<Record5<String, String, String, String, String>> fetchKeys(String constraintType) {
return create().select(
Sysschemas.SCHEMANAME,
Systables.TABLENAME,
Systables.TABLEID,
Sysconstraints.CONSTRAINTNAME,
Sysconglomerates.DESCRIPTOR)
.from(SYSCONGLOMERATES)
.join(SYSKEYS)
.on(Syskeys.CONGLOMERATEID.equal(Sysconglomerates.CONGLOMERATEID))
.join(SYSCONSTRAINTS)
.on(Sysconstraints.CONSTRAINTID.equal(Syskeys.CONSTRAINTID))
.join(SYSTABLES)
.on(Systables.TABLEID.equal(Sysconglomerates.TABLEID))
.join(SYSSCHEMAS)
.on(Sysschemas.SCHEMAID.equal(Systables.SCHEMAID))
// [#6797] The casts are necessary if a non-standard collation is used
.and(Sysschemas.SCHEMANAME.cast(VARCHAR(32672)).in(getInputSchemata()))
.where(Sysconstraints.TYPE.cast(VARCHAR(32672)).equal(constraintType))
.orderBy(
Sysschemas.SCHEMANAME,
Systables.TABLENAME,
Sysconstraints.CONSTRAINTNAME)
.fetch();
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public List<ProcessEventEntry> list(ProcessKey processKey, Timestamp geTimestamp, String eventType, Map<String, Object> dataFilter, int limit) {
try (DSLContext tx = DSL.using(cfg)) {
SelectConditionStep<Record4<UUID, String, Timestamp, String>> q = tx
.select(PROCESS_EVENTS.EVENT_ID,
PROCESS_EVENTS.EVENT_TYPE,
PROCESS_EVENTS.EVENT_DATE,
PROCESS_EVENTS.EVENT_DATA.cast(String.class))
.from(PROCESS_EVENTS)
.where(PROCESS_EVENTS.INSTANCE_ID.eq(processKey.getInstanceId())
.and(PROCESS_EVENTS.INSTANCE_CREATED_AT.eq(processKey.getCreatedAt())));
if (geTimestamp != null) {
q.and(PROCESS_EVENTS.EVENT_DATE.ge(geTimestamp));
}
if (eventType != null) {
q.and(PROCESS_EVENTS.EVENT_TYPE.eq(eventType));
}
if (dataFilter != null) {
dataFilter.forEach((k, v) -> {
q.and(field("{0}->>{1}", Object.class, PROCESS_EVENTS.EVENT_DATA, inline(k)).eq(v));
});
}
if (limit > 0) {
q.limit(limit);
}
return q.orderBy(PROCESS_EVENTS.EVENT_DATE)
.fetch(EventDao::toEntry);
}
}
代码示例来源:origin: org.jooq/jooq-meta
.where(Syscolumns.REFERENCEID.cast(VARCHAR(32672)).equal(inline(tableid)))
.orderBy(Syscolumns.COLUMNNUMBER)
.fetch()) {
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
specField,
timezoneField,
t.ARGUMENTS.cast(String.class),
t.TRIGGER_CFG.cast(String.class),
currentTimestamp())
.from(t)
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public PolicyRules getRules(DSLContext tx, UUID orgId, UUID projectId, UUID userId) {
PolicyEntry entry = getLinked(tx, orgId, projectId, userId);
if (entry == null || entry.rules().isEmpty()) {
return null;
}
Result<Record3<String, String, Integer>> rules = tx.withRecursive("children").as(
select(POLICIES.POLICY_ID, POLICIES.PARENT_POLICY_ID, POLICIES.POLICY_NAME, POLICIES.RULES, field("1", Integer.class).as("level")).from(POLICIES)
.where(POLICIES.POLICY_ID.eq(entry.id()))
.unionAll(
select(POLICIES.POLICY_ID, POLICIES.PARENT_POLICY_ID, POLICIES.POLICY_NAME, POLICIES.RULES, field("children.level + 1", Integer.class).as("level")).from(POLICIES)
.join(name("children"))
.on(POLICIES.POLICY_ID.eq(
field(name("children", "PARENT_POLICY_ID"), UUID.class)))))
.select(POLICIES.as("children").POLICY_NAME, POLICIES.as("children").RULES.cast(String.class), field("level", Integer.class))
.from(name("children"))
.orderBy(field("level").desc())
.fetch();
ImmutablePolicyRules.Builder result = ImmutablePolicyRules.builder();
Map<String, Object> mergedRules = new HashMap<>();
for(Record3<String, String, Integer> r : rules) {
result.addPolicyNames(r.value1());
mergedRules = ConfigurationUtils.deepMerge(mergedRules, deserialize(r.value2()));
}
return result
.rules(mergedRules)
.build();
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
private List<InventoryDataItem> get(DSLContext tx, UUID inventoryId, String path) {
Table<Record> nodes = table("nodes");
Inventories i1 = INVENTORIES.as("i1");
Inventories i2 = INVENTORIES.as("i2");
SelectConditionStep<Record3<UUID, UUID, Integer>> s1 =
select(i1.INVENTORY_ID, i1.PARENT_INVENTORY_ID, value(1))
.from(i1)
.where(i1.INVENTORY_ID.eq(inventoryId));
SelectConditionStep<Record3<UUID, UUID, Integer>> s2 =
select(i2.INVENTORY_ID, i2.PARENT_INVENTORY_ID, level().add(1))
.from(i2, nodes)
.where(i2.INVENTORY_ID.eq(INVENTORIES.as("nodes").PARENT_INVENTORY_ID));
SelectConditionStep<Record3<String, String, Integer>> s = tx.withRecursive("nodes", INVENTORIES.INVENTORY_ID.getName(), INVENTORIES.PARENT_INVENTORY_ID.getName(), "level")
.as(s1.unionAll(s2))
.select(INVENTORY_DATA.ITEM_PATH, INVENTORY_DATA.ITEM_DATA.cast(String.class), level())
.from(INVENTORY_DATA, nodes)
.where(INVENTORY_DATA.INVENTORY_ID.eq(INVENTORIES.as("nodes").INVENTORY_ID)
.and(INVENTORY_DATA.ITEM_PATH.startsWith(path)));
return s.fetch(this::toEntry);
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
POLICIES.PARENT_POLICY_ID,
POLICIES.POLICY_NAME,
POLICIES.RULES.cast(String.class),
POLICY_LINKS.ORG_ID,
POLICY_LINKS.PROJECT_ID,
内容来源于网络,如有侵权,请联系作者删除!