本文整理汇总了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!");
}
}