Giter Site home page Giter Site logo

Comments (19)

casatwy avatar casatwy commented on July 29, 2024

好的,看来我要在test case里把所有类型都test一遍…

from ctpersistance.

BigNerdCoding avatar BigNerdCoding commented on July 29, 2024

@casatwy 这个点没睡?

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

没睡~

from ctpersistance.

BigNerdCoding avatar BigNerdCoding commented on July 29, 2024

@casatwy 顺便问一下,Table 的 columnInfo 协议里面可以实现默认值吗?

另一个问题是,好像 HMDBDeviceInfoRecord 不支持 long long ?我原本准备使用 long long 保存时间戳,后来发现好像不行就改为 double 。

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

这个功能可以有😂

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

@BigNerdCoding HMDBDeviceInfoRecord?我存数据的时候用的是Integer,SQLite应该是支持long long长度的,你可以写一个test case确认一下

from ctpersistance.

BigNerdCoding avatar BigNerdCoding commented on July 29, 2024

@casatwy 我在对公司的底层存储库代码进行重构,准备全部迁移到您的 Pod 上。我觉得你代码中 Table 与 Model 分离的设计比 Realm 那种情形要好。

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

👌
那我尽早把double的那个事情搞定

至于Column Info里面放default value的事情,本质上Column Info就是创建SQL语句的一部分,SQL语句是支持Default的,你可以看一下SQL语法

from ctpersistance.

BigNerdCoding avatar BigNerdCoding commented on July 29, 2024

@casatwy 大量代码重构工作量占了我时间,后面一定深入研究下你的代码。Column Info 作为协议方法只能包含类型和字段名是没问题的,我想能否再加一个协议方法来维护默认值?代码深入研究好,没准给你发个 PR。非常感谢你的回复。

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

多谢了

如果你想提个PR来做什么事情,可以跟我说一下,我会告诉你相关的部分我当初是怎么设计的,这样你就不必花太多时间去研究了

维护默认值的意义在于?是什么场景导致了默认值需要维护?

from ctpersistance.

BigNerdCoding avatar BigNerdCoding commented on July 29, 2024

我重构的代码库会被多个项目使用,其中有 Swift 项目。现在他们那边发现如果我这边 Record 通过自定义 Protocol 暴露出去的时候,若 NSString 类型值为空可能 Swift 访问该属性就会崩溃。所以现在我必须在数据库修改操作之前确保对应字段为空字符串。问题还没有具体排查精准定位,但是有一点可以确定的是返回空字符串不会出现崩溃。所以,默认值对我来说就是为了在 Table 定义时强制约束好,而不用通过手动维护来确保。我相信前者会来的更稳健也更符合 SQL 使用常规。

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

值为空的话,取出来的数据我会返回NSNull而不是nil~

from ctpersistance.

BigNerdCoding avatar BigNerdCoding commented on July 29, 2024

@casatwy 我提到的 double 问题并不是一定存在,只有到 double 数字非常大的时候你代码中的判断才会导致溢出问题,例如毫秒数取整的时间戳。而对于小型数值则没有问题。

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

你提到的double的问题确实是一个问题,因为我没有做REAL的判断😂

我现在正在改,改好了之后我会通知你

from ctpersistance.

BigNerdCoding avatar BigNerdCoding commented on July 29, 2024

@casatwy 不用这么急,先好好休息。我现在通过两次更新能解决问题,时间戳字段我单独再更新了一次😂。

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

double的问题我解决了,新版本163

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

反正你有问题就提好了,该是我CTPersistance的错误,我就去把它改掉😂

from ctpersistance.

BigNerdCoding avatar BigNerdCoding commented on July 29, 2024

@casatwy 像你这样的开发者真是不多见,真的非常感谢,向你看齐。

from ctpersistance.

casatwy avatar casatwy commented on July 29, 2024

哈哈,多亏你问题描述得清楚,我改起来就轻松一些

from ctpersistance.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.