V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
mscsky
V2EX  ›  Scala

请问我下载了乌云的 digatalAllData,说明上写着用 case class 解析出数据,那有没有详细的方法?

  •  
  •   mscsky · 2017-03-02 21:34:59 +08:00 · 4394 次点击
    这是一个创建于 2583 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如题,下载了 2.9g 的数据不熟悉 scala 不知道怎么读取出来 readme 如下

    “如果使用 scala,可以使用如下 case class 解析出数据

    
    case class Answer(answer_id: Long,
    				  question_id: Long,
    				  question_title: String, 
    				  question_topics: Array[Long], 
    				  votup_count: Long)
    
    case class Article(id: Long, title: String, votup_count: Long)
    case class Question(question_followers: Long, 
    					question_id: Long, 
    					question_title: String, 
    					question_topics: Array[Long])
    
    case class userStringId(CREATED_ANSWERS: Array[Answer],
                              CREATED_ARTICLES: Array[Article],
                              CREATED_QUESTIONS: Array[Question],
                              FOLLOWED_QUESTIONS: Array[Question],
                              VOTEUPED_ANSWERS: Array[Answer],
                              VOTEUPED_ARTICLES: Array[Article],
                              followers_count: Long,
                              id: String)
    
    case class userDigitalId(CREATED_ANSWERS: Array[Answer],
                               CREATED_ARTICLES: Array[Article],
                               CREATED_QUESTIONS: Array[Question],
                               FOLLOWED_QUESTIONS: Array[Question],
                               VOTEUPED_ANSWERS: Array[Answer],
                               VOTEUPED_ARTICLES: Array[Article],
                               followers_count: Long,
                               id: Long)
    
    1 条回复    2017-06-22 17:06:44 +08:00
    funky
        1
    funky  
       2017-06-22 17:06:44 +08:00
    case class 一般是你要转的 model
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1240 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 18:03 · PVG 02:03 · LAX 11:03 · JFK 14:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.