社区首页 >问答首页 >如何使用jOOQ gradle插件将postgres中的bigint[]字段转换为类字段

如何使用jOOQ gradle插件将postgres中的bigint[]字段转换为类字段
EN

Stack Overflow用户
提问于 2020-06-18 15:53:05
回答 3查看 321关注 0票数 0

大家好,感兴趣的人:)我对jOOQ有一些问题。我需要从PostgreSQL表生成jOOQ实体。它有一个bigint[]类型的字段。jOOQ Gradle插件(我正在使用这个https://github.com/etiennestuder/gradle-jooq-plugin)不支持数组DateType,所以唯一的方法是使用带有强制类型的自定义类型

代码语言:javascript
代码运行次数:0
复制
// jooq config in build.gradle
customTypes {
    customType {
        name = "BigintArrayBinder"
        type = "Long[]"
        converter = "ru.stdev.tskad.yandexnavigator.binder.BigintArrayBinder"
    }
}
forcedTypes {
    forcedType {
        name = "BigintArrayBinder"
        includeExpression = '.*'
        includeTypes = 'ARRAY'
    }
}

这是这个绑定器及其转换器的实现

代码语言:javascript
代码运行次数:0
复制
public class BigintArrayConverter implements Converter<Object[], Long[]> {

    @Override
    public Long[] from(Object[] t) {
        return t == null ? new Long[]{} : (Long[]) t;
    }

    @Override
    public Object[] to(Long[] u) {
        return u == null || u.length == 0 ? new Object[]{} : u;
    }

    @Override
    public Class<Object[]> fromType() {
        return Object[].class;
    }

    @Override
    public Class<Long[]> toType() {
        return Long[].class;
    }

}
代码语言:javascript
代码运行次数:0
复制
import org.jooq.*;
import org.jooq.conf.ParamType;
import org.jooq.impl.DSL;
import org.postgresql.core.BaseConnection;
import org.postgresql.jdbc.PgArray;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class BigintArrayBinder implements Binding<Object[], Long[]> {

    // The converter does all the work
    @Override
    public Converter<Object[], Long[]> converter() {
        return new BigintArrayConverter();
    }

    // Rending a bind variable for the binding context's value and casting it to the json type
    @Override
    public void sql(BindingSQLContext<Long[]> ctx) throws SQLException {
        // Depending on how you generate your SQL, you may need to explicitly distinguish
        // between jOOQ generating bind variables or inlined literals.
        if (ctx.render().paramType() == ParamType.INLINED)
            ctx.render().visit(DSL.inline(ctx.convert(converter()).value())).sql("::bigint[]");
        else
            ctx.render().sql("::bigint[]");
    }

    // Registering ARRAY types for JDBC CallableStatement OUT parameters
    @Override
    public void register(BindingRegisterContext<Long[]> ctx) throws SQLException {
        ctx.statement().registerOutParameter(ctx.index(), Types.ARRAY);
    }

    // Converting the Long[] to a bigint[] value and setting that on a JDBC PreparedStatement
    @Override
    public void set(BindingSetStatementContext<Long[]> ctx) throws SQLException {
        Object[] value = ctx.convert(converter()).value();

        BaseConnection connection = (BaseConnection) DriverManager.getConnection(
                "jdbc:postgresql://localhost:5432/m4",
                "postgres",
                "postgres"
        );

        int longOid = 20;

        System.out.print("value -> ");
        System.out.println(Arrays.toString(value));

        PgArray pgArray = new PgArray(connection, longOid, Arrays.toString(value));

        ctx.statement().setArray(ctx.index(), pgArray);
    }

    // Getting a bigint[] value from a JDBC ResultSet and converting that to a Long[]
    @Override
    public void get(BindingGetResultSetContext<Long[]> ctx) throws SQLException {
        Object[] array = (Object[]) ctx.resultSet().getArray(ctx.index()).getArray();

        ctx.convert(converter()).value(array);
    }

    // Getting a bigint[] value from a JDBC CallableStatement and converting that to a Long[]
    @Override
    public void get(BindingGetStatementContext<Long[]> ctx) throws SQLException {
        Object[] array = (Object[]) ctx.statement().getArray(ctx.index()).getArray();
        ctx.convert(converter()).value(array);
    }

    // Setting a value on a JDBC SQLOutput (useful for Oracle OBJECT types)
    @Override
    public void set(BindingSetSQLOutputContext<Long[]> ctx) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    // Getting a value from a JDBC SQLInput (useful for Oracle OBJECT types)
    @Override
    public void get(BindingGetSQLInputContext<Long[]> ctx) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

}

因此,它可以编译并很好地处理selects查询。但是如果我尝试做插入操作,我会有这样的异常

代码语言:javascript
代码运行次数:0
复制
org.jooq.exception.DataAccessException: SQL [null]; Error while writing value at JDBC bind index: 7
    at org.jooq_3.13.1.POSTGRES.debug(Unknown Source)
    at org.jooq.impl.Tools.translate(Tools.java:2751)
    at org.jooq.impl.AbstractBindContext.bindValue(AbstractBindContext.java:127)
    at org.jooq.impl.Val.accept(Val.java:103)
    at org.jooq.impl.AbstractBindContext.bindInternal(AbstractBindContext.java:269)
    at org.jooq.impl.AbstractBindContext.visit0(AbstractBindContext.java:88)
    at org.jooq.impl.AbstractContext.visit0(AbstractContext.java:457)
    at org.jooq.impl.AbstractContext.visit(AbstractContext.java:218)
    at org.jooq.impl.QueryPartList.accept(QueryPartList.java:121)
    at org.jooq.impl.AbstractBindContext.bindInternal(AbstractBindContext.java:269)
    at org.jooq.impl.AbstractBindContext.visit0(AbstractBindContext.java:88)
    at org.jooq.impl.AbstractContext.visit0(AbstractContext.java:457)
    at org.jooq.impl.AbstractContext.visit(AbstractContext.java:218)
    at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:367)
    at org.jooq.impl.AbstractDelegatingQuery.execute(AbstractDelegatingQuery.java:119)
    at ru.stdev.tskad.yandexnavigator.repository.NavigatorRepository$testInsert$2.invokeSuspend(NavigatorRepository.kt:37)
    at ru.stdev.tskad.yandexnavigator.repository.NavigatorRepository$testInsert$2.invoke(NavigatorRepository.kt)
    at ru.stdev.utp.common.jooq.DefaultJooqWrapper$launchOperation$1.invokeSuspend(DefaultJooqWrapper.kt:17)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:330)
    at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26)
    at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109)
    at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:58)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at ru.stdev.utp.common.jooq.DefaultJooqWrapper.launchOperation(DefaultJooqWrapper.kt:16)
    at ru.stdev.utp.common.jooq.DefaultJooqWrapper.request(DefaultJooqWrapper.kt:27)
    at ru.stdev.tskad.yandexnavigator.repository.NavigatorRepository.testInsert(NavigatorRepository.kt:25)
    at ru.stdev.tskad.yandexnavigator.routes.NavigatorRouteKt$navigator$1.invokeSuspend(NavigatorRoute.kt:23)
    at ru.stdev.tskad.yandexnavigator.routes.NavigatorRouteKt$navigator$1.invoke(NavigatorRoute.kt)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:318)
    at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:163)
    at io.ktor.util.pipeline.SuspendFunctionGun.execute(PipelineContext.kt:183)
    at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:27)
    at io.ktor.routing.Routing.executeResult(Routing.kt:147)
    at io.ktor.routing.Routing.interceptor(Routing.kt:34)
    at io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:99)
    at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:318)
    at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:163)
    at io.ktor.features.ContentNegotiation$Feature$install$1.invokeSuspend(ContentNegotiation.kt:107)
    at io.ktor.features.ContentNegotiation$Feature$install$1.invoke(ContentNegotiation.kt)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:318)
    at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:163)
    at io.ktor.features.StatusPages$interceptCall$2.invokeSuspend(StatusPages.kt:101)
    at io.ktor.features.StatusPages$interceptCall$2.invoke(StatusPages.kt)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
    at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:194)
    at io.ktor.features.StatusPages.interceptCall(StatusPages.kt:100)
    at io.ktor.features.StatusPages$Feature$install$2.invokeSuspend(StatusPages.kt:140)
    at io.ktor.features.StatusPages$Feature$install$2.invoke(StatusPages.kt)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:318)
    at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:163)
    at io.ktor.features.CallLogging$Feature$install$2.invokeSuspend(CallLogging.kt:139)
    at io.ktor.features.CallLogging$Feature$install$2.invoke(CallLogging.kt)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:318)
    at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:163)
    at io.ktor.util.pipeline.SuspendFunctionGun.execute(PipelineContext.kt:183)
    at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:27)
    at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:120)
    at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt)
    at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:318)
    at io.ktor.util.pipeline.SuspendFunctionGun.proceed(PipelineContext.kt:163)
    at io.ktor.util.pipeline.SuspendFunctionGun.execute(PipelineContext.kt:183)
    at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:27)
    at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:40)
    at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
    at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
    at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
    at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
    at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:30)
    at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:24)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
    at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:59)
    at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:368)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.sql.SQLException: Error while writing value at JDBC bind index: 7
    at org.jooq.impl.DefaultBindContext.bindValue0(DefaultBindContext.java:67)
    at org.jooq.impl.AbstractBindContext.bindValue(AbstractBindContext.java:124)
    ... 81 common frames omitted
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 63 out of bounds for length 63
    at org.postgresql.jdbc.PgArray.buildArrayList(PgArray.java:450)
    at org.postgresql.jdbc.PgArray.getBaseTypeName(PgArray.java:811)
    at org.postgresql.jdbc.PgPreparedStatement.setArray(PgPreparedStatement.java:1098)
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setArray(HikariProxyPreparedStatement.java)
    at org.jooq.tools.jdbc.DefaultPreparedStatement.setArray(DefaultPreparedStatement.java:239)
    at ru.stdev.tskad.yandexnavigator.binder.BigintArrayBinder.set(BigintArrayBinder.java:63)
    at org.jooq.impl.DefaultBindContext.bindValue0(DefaultBindContext.java:62)
    ... 82 common frames omitted

让我困惑的第一件事是创建BaseConnection。我可以从DslContext获取连接,但它返回一个HikariProxyConnection。所以,它不适用于PgArray,它需要BaseConnection。然后,我需要给它一个oid,它等于20 to Long类型。然后我必须以字符串或字节数组的形式给出一个数组。结果是我有了ArrayIndexOutOfBoundsException。我做了很多次尝试来寻找这个问题的答案,但是我失败了。我做错了什么?我觉得我做错了什么,但我不明白到底是什么。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2020-06-19 21:44:21

你应该试试Connection.createArrayOf()

例如ctx.statement().getConnection().createArrayOf(...)

票数 1
EN

Stack Overflow用户

发布于 2020-06-18 17:30:38

你为什么要这么做?

代码语言:javascript
代码运行次数:0
复制
BaseConnection connection = (BaseConnection) DriverManager.getConnection(
                "jdbc:postgresql://localhost:5432/m4",
                "postgres",
                "postgres"
        );

此时,您应该已经有了一个连接。由于您从未关闭此连接,因此这里可能存在资源泄漏。

你也许可以做到

代码语言:javascript
代码运行次数:0
复制
BaseConnection connection = (BaseConnection)  ctx.statement().getConnection()
票数 0
EN

Stack Overflow用户

发布于 2020-06-22 03:41:06

代码解决方案:

代码语言:javascript
代码运行次数:0
复制
public class BigintArrayBinder implements Binding<Object[], Long[]> {

    // The converter does all the work
    @Override
    public Converter<Object[], Long[]> converter() {
        return new BigintArrayConverter();
    }

    // Rending a bind variable for the binding context's value and casting it to the bigint array type
    @Override
    public void sql(BindingSQLContext<Long[]> ctx) throws SQLException {
        ctx.render().visit(DSL.inline(ctx.convert(converter()).value()));
    }

    // Registering ARRAY types for JDBC CallableStatement OUT parameters
    @Override
    public void register(BindingRegisterContext<Long[]> ctx) throws SQLException {
        ctx.statement().registerOutParameter(ctx.index(), Types.ARRAY);
    }

    // Converting the Long[] to a bigint[] value and setting that on a JDBC PreparedStatement
    @Override
    public void set(BindingSetStatementContext<Long[]> ctx) {
        Object[] value = ctx.convert(converter()).value();

        ctx.dsl().connection(connection -> connection.createArrayOf("bigint", value));
    }

    // Getting a bigint[] value from a JDBC ResultSet and converting that to a Long[]
    @Override
    public void get(BindingGetResultSetContext<Long[]> ctx) throws SQLException {
        Object[] array = (Object[]) ctx.resultSet().getArray(ctx.index()).getArray();

        ctx.convert(converter()).value(array);
    }

    // Getting a bigint[] value from a JDBC CallableStatement and converting that to a Long[]
    @Override
    public void get(BindingGetStatementContext<Long[]> ctx) throws SQLException {
        Object[] array = (Object[]) ctx.statement().getArray(ctx.index()).getArray();
        ctx.convert(converter()).value(array);
    }

    // Setting a value on a JDBC SQLOutput (useful for Oracle OBJECT types)
    @Override
    public void set(BindingSetSQLOutputContext<Long[]> ctx) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    // Getting a value from a JDBC SQLInput (useful for Oracle OBJECT types)
    @Override
    public void get(BindingGetSQLInputContext<Long[]> ctx) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62454120

复制
相关文章
facebook营销工具
Facebook一直以来都是我们做外贸的一个主要流量来源,很多人不知道的是,我们在平时也可以借助第三工具来帮助我们进行营销。下面一米软件为大家整理的几款常用facebook营销工具,希望能对大家有所帮助。
用户3736847
2018/10/30
1.5K0
facebook营销工具
file指定路径_目标实现的策略与路径
通常设置android:exported="false",以保证权限最小化。 android:resource="@xml/filepath_data"中,filepath_data.xml文件是配置哪些路径是可以通过FileProvider访问的。 meta-data是以键值对的方式保存(key-value pairs)。android.support.FILE_PROVIDER_PATHS作为meta-data的键(key),@xml/filepath_data作为meta-data的值(value)。在FileProvider中会读取meta-data中的android.support.FILE_PROVIDER_PATHS对应的值。
全栈程序员站长
2022/11/17
1.3K0
Facebook可以救命吗?
平安信使    脸书直播 产生洞见、查明问题、提出方案、鼓励新的领导方式、推出商业模式
邱翔Alex
2018/05/21
1.4K0
【营销101】Facebook图谱搜索应用指南
译者:李晓艳 本文长度为5511字,预估阅读时间10分钟。 摘要:作者通过详尽的介绍,手把手教你玩转Facebook图谱搜索 社交搜索很长时间以来都被誉为“下一个大牛”,因为给人类创造搜索引擎
iCDO互联网数据官
2018/03/05
1.4K0
【营销101】Facebook图谱搜索应用指南
Facebook Graph API(1)—介绍
Facebook提供三种low-level HTTP APIS去访问Facebook Graph. 1.Graph API 2.FQL(过期) 3.Legacy REST API(过期) 为什么要学习Graph API 1.Open Graph可以让广大用户发现你的应用或者业务 2.可以加入更多社交内容,你的朋友可能会对你的内容感兴趣 3.使用Facebook Login统一登录,可以减少投入,并且可以跨不同设备。 The Graph API Explorer API Explorer是一个低级工具,使用它
八哥
2018/01/18
2K0
Facebook Graph API(1)—介绍
通过网站SEO运营达到吸粉营销的目标(建个网站能干什么网站)网站可以做营销吗
真正懂网站价值的人都在几年前就开始吸粉了,而且粉丝很精准有效,因为网站是共存在搜索引擎中的,而粉丝大多数都是精准搜索而来,所以在网站行业存在很长时间用seo运营吸粉卖平台账号和导粉的买卖,这其实也给不懂网站价值的人和公司一个很好的信号,就是建立网站做粉丝营销。
文曦
2022/06/15
1.6K0
通过网站SEO运营达到吸粉营销的目标(建个网站能干什么网站)网站可以做营销吗
给我5分钟,带你玩转Facebook营销!
译者:Amber 审校:朱玉雪 本文长度为1677字,预估阅读时间5分钟。 摘要:本文通过介绍本地企业认识到Facebook在信息传播上的重要作用,并通过其进行营销活动。 Facebook作为社交网络平台无需介绍。拥有81%的北美成年人口的用户群体,Facebook的用户数量傲视Twitter, Pinterest, LinkedIn及其它一众竞争对手。 正是因为Facebook无处不在,许多企业主相信一个活跃在Facebook上的公司形象对于企业或品牌在线上的成功至关重要。毫无疑问,这句话在很多情况下
iCDO互联网数据官
2018/03/05
9960
给我5分钟,带你玩转Facebook营销!
Facebook vs YouTube视频营销大战,到底哪家强?
译者:李晓艳 本文长度为3631字,预估阅读时间5分钟。 我们今天要向大家分享Facebook vs YouTube视频营销大战到底哪家强的一些观点。 近年来线上视频内容呈现有增无减的迹象。据Cisco Forecast(https://www.cisco.com/c/en/us/solutions/collateral/service-provider/visual-networking-index-vni/complete-white-paper-c11-481360.html)预测,到2017年视频将
iCDO互联网数据官
2018/03/05
1.9K0
Facebook vs YouTube视频营销大战,到底哪家强?
数字化营销前瞻:全域营销与营销技术
“5G+数字化”时代到来,与无数人生活和工作密切相关的商业体系被影响、推动着,发生着复杂的变化。 我们能否跳出传统意义上的营销逻辑,为中国互联网从业者提供崭新的视角——从变现增长的角度看待企业的商业化发展,从技术的角度赋能营销? 为了回答以上问题,我们特地邀请到互联网全域营销资深专家聂风老师和Martech行业布道者冯祺老师为大家直播分享“数字化营销前瞻——全域营销与营销技术”,欢迎大家关注学习。 分享主题:数字化营销前瞻——全域营销与营销技术 嘉宾简介: 聂风,阿里巴巴、淘宝网早期营销人、去哪儿前首席营
博文视点Broadview
2023/05/19
1.4K0
数字化营销前瞻:全域营销与营销技术
Scrapy:多个spider时指定pipeline
导读 Scrapy存在多个爬虫的时候如何指定对应的管道呢? 1、在 pipeline 里判断爬虫 settings.py ITEM_PIPELINES = { "xxxx.pipelines.MyPipeline": 300, } OneSpider.py class OneSpider(scrapy.spiders.Spider): name = "one" TwoSpider.py class TwoSpider(scrapy.spiders.Spider): name = "t
新码农
2020/04/17
2.2K0
Scrapy:多个spider时指定pipeline
营销4.0时代,数据、技术如何驱动品牌营销增长?
在互联网迅猛发展的大背景下,PC端、手机端的流量增长、转移,消费者的阅读习惯、行为路径以及接收信息的渠道和方式等等都发生了巨变。与此同时,科技的进步也引领着整个行业与社会进步,催生新的商业生态,并迸发出新的火花。
盈鱼MA
2019/12/24
1.6K0
营销4.0时代,数据、技术如何驱动品牌营销增长?
Scrapy:多个item时指定pipeline
有时,为了数据的干净清爽,我们可以定义多个item,不同的item存储不同的数据,避免数据污染。但是在pipeline对item进行操作的时候就要加上判断。
新码农
2020/04/17
2.7K0
Scrapy:多个item时指定pipeline
ts结构赋值时指定类型
我们在typescript中使用变量结构时如果需要指定类型,可以这样写: const { a, b, c }: { a: any; b: string; c: { cname: any; cid: any; } } = obj; 但一般还是定义接口 interface IObj { a: any; b: string; c: IC; } interface IC { cname: any; cid: any; } const { a, b, c }: IObj = o
阿超
2022/08/21
1.2K0
照相时眨眼了怎么办?Facebook研究者创建AI系统,可以生成“假眼”
你可能在照相时遇到以下的情况:闪光灯闪烁,你控制不住眨了眼,照片上也许就显示出你闭眼的样子。Facebook的研究人员创建了一个人工智能系统,该系统可以用计算机生成的图像来代替闭合的眼睛。
AiTechYun
2018/07/27
8760
照相时眨眼了怎么办?Facebook研究者创建AI系统,可以生成“假眼”
认知系列2:认知半径认知系列2:认知半径
美国气象学家J·马歇尔·谢博德(J. Marshall Shepherd)就在TED的舞台上,提出一个“认知半径”原理,把人的认知范围比作一个圆圈,认知半径越大,人的认知范围也就越广,也就是对事物的认识更清晰,掌握事物的本质更深入。
黄规速
2022/04/14
5810
认知系列2:认知半径认知系列2:认知半径
SaaS营销分析:SaaS厂商目标客户定位模型
现在的SaaS市场到了要从营销突破的关键点了。从今天开始,我想对SaaS厂商该如何营销谈些我的体会。当然,这只是分享我的看法,希望对我的朋友有所借鉴。这也有可能存在很多不完善的地方,希望朋友们指出,并
静一
2018/03/22
1.7K0
SaaS营销分析:SaaS厂商目标客户定位模型
Python 3.12 目标:还可以更快!
按照发布计划,Python 3.11.0 将于 2022 年 10 月 24 日发布。
Python猫
2022/10/06
8570
Iframe 标签显示目标网页的指定区域
有些时候我们并不需要显示 iframe 标签属性 src 指定的目标网页的所有内容,往往只需要显示某一特定区域。原理很简单,但是像站长这种野路子出身的可能真不知道,主要用到了 position 的定位 x,y 值
Savalone
2020/01/06
2.8K0
SpringBoot启动时执行指定任务
@EventListener({ApplicationReadyEvent.class})
乐心湖
2020/07/31
6980
API 治理的目标是什么?
建立有效的API治理需要正确理解其目标,但它究竟是什么呢?是定义标准或规则并应用它们吗?都不是。虽然这些是治理的一个重要手段,但这并非其最终目的。为了揭示API治理的真正目标,让我们探讨一下在适当地制定标准后能得到什么。
API 小达人
2023/07/18
2810

相似问题

Folium将叠加(.geojson)添加到地图

10

将外部geojson添加到传单层

11

在Mapbox-GL-JS中从具有多种类型的GeoJSON文件渲染FeatureCollection

11

将弹出窗口添加到geojson叶折线

118

将geoJSON特性属性添加到mapbox弹出窗口

11
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文