本文整理匯總了Java中org.jooq.DSLContext.newRecord方法的典型用法代碼示例。如果您正苦於以下問題:Java DSLContext.newRecord方法的具體用法?Java DSLContext.newRecord怎麽用?Java DSLContext.newRecord使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jooq.DSLContext
的用法示例。
在下文中一共展示了DSLContext.newRecord方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createGuildSettings
import org.jooq.DSLContext; //導入方法依賴的package包/類
public static void createGuildSettings(DiscordBot bot, DSLContext database, Guild guild) {
SettingsRecord record = database.newRecord(Tables.SETTINGS);
record.setGuildid(guild.getId());
record.setSilentcommands(false);
record.setInvitelinkremover(false);
record.setModlog(false);
record.setModlogchannelid(DiscordUtils.getDefaultChannel(guild).getId());
record.setHoldingroom(false);
record.setHoldingroomroleid(null);
record.setHoldingroomminutes(3);
record.setPrefix(bot.getConfig().jim.default_prefix);
record.setWelcomemessage(false);
record.setMessage(DEFAULT_WELCOME_MESSAGE);
record.setWelcomemessagechannelid(DiscordUtils.getDefaultChannel(guild).getId());
record.setNospaceprefix(false);
record.setStatistics(false);
record.store();
}
示例2: handle
import org.jooq.DSLContext; //導入方法依賴的package包/類
@Override
public void handle(RoutingContext ctx, Server server, DiscordBot bot, DSLContext database) {
HttpServerRequest request = ctx.request();
HttpServerResponse response = ctx.response();
String code = request.getParam("code");
if (code == null) {
response.setStatusCode(400);
response.end();
return;
}
DiscordSecrets secrets = DiscordApiUtils.getUserSecrets(config, code);
if (secrets == null || !secrets.scope.equals("guilds identify")) {
response.setStatusCode(400);
response.end();
return;
}
SelfUser self = DiscordApiUtils.getSelf(secrets.accessToken);
if (self == null) {
response.setStatusCode(400);
response.end();
return;
}
Long now = (new Date().getTime()) / 1000;
OauthsecretsRecord record = database.newRecord(Tables.OAUTHSECRETS);
record.setUserid(self.id);
record.setAccesstoken(secrets.accessToken);
record.setRefreshtoken(secrets.refreshToken);
record.setExpirationdate(now + secrets.expiresIn);
database.insertInto(Tables.OAUTHSECRETS)
.set(record)
.onDuplicateKeyUpdate()
.set(record)
.execute();
String token = getJwtToken(self.id);
response.putHeader("Content-Type", "application/json");
response.end("\"" + token + "\"");
}
示例3: addTag
import org.jooq.DSLContext; //導入方法依賴的package包/類
private void addTag(DiscordBot bot, GuildMessageReceivedEvent event, Scanner messageIterator) {
DSLContext database = bot.getDatabase();
Guild guild = event.getGuild();
Message message = event.getMessage();
Member member = event.getMember();
if (!member.hasPermission(Permission.ADMINISTRATOR)) {
DiscordUtils.failMessage(bot, message, "You don't have enough permissions to use this command!");
return;
}
if (!messageIterator.hasNext()) {
DiscordUtils.failMessage(bot, message, "Please provide a tag name and a response to create a new tag!");
return;
}
String tagName = messageIterator.next();
if (isSubcommand(tagName)) {
DiscordUtils.failMessage(bot, message, "You can't create a tag with the same name as a subcommand!");
return;
}
String response = TextUtils.seekScannerToEnd(messageIterator);
if (response.equals("")) {
DiscordUtils.failMessage(bot, message, "Empty responses aren't allowed!");
return;
}
TaglistRecord record = database.newRecord(Tables.TAGLIST);
record.setGuildid(guild.getId());
record.setName(tagName);
record.setResponse(response);
try {
record.store();
DiscordUtils.successReact(bot, message);
} catch (Exception e) {
DiscordUtils.failMessage(bot, message, "Tag `" + tagName + "` already exists!");
}
}