我正在尝试使用 Firebase。我有很强的 MS SQL Server 数据库背景。您如何验证保存在 Firebase 中的 JSON 数据以匹配特定结构?有没有办法将“接口(interface)”应用于 JSON 以确保我们具有正确的结构?不然你怎么对保存的数据有信心?
最佳答案
架构!听起来你会喜欢 the Bolt compiler !
Bolt 编译器是您在 Firebase 中表达模式的方式。
使用 Bolt,您可以将类型表达为模式,然后将其应用于存储数据的路径。
// Create the schema for a Post type
type Post {
title: String;
author: String;
description: String;
timestamp: Number;
isPublished: Boolean;
}
// All data stored at "/posts" will conform to the Post type above
path /posts is Post;
还有一个 quick-start和 guide帮助您入门。
关于database - 在保存之前验证 Firebase JSON 的结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33657596/