当前位置: 首页>>代码示例>>Java>>正文


Java DSLContext.newRecord方法代码示例

本文整理汇总了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();
}
 
开发者ID:Samoxive,项目名称:SafetyJim,代码行数:21,代码来源:DatabaseUtils.java

示例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 + "\"");
}
 
开发者ID:Samoxive,项目名称:SafetyJim,代码行数:44,代码来源:Login.java

示例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!");
    }
}
 
开发者ID:Samoxive,项目名称:SafetyJim,代码行数:44,代码来源:Tag.java


注:本文中的org.jooq.DSLContext.newRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。