Glaze 数据模型
陶瓷流引用的异名
文档
安装
npm install @glazed/datamodel
示例
import { CeramicClient } from '@ceramicnetwork/http-client'
import { DataModel } from '@glazed/datamodel'
// The model aliases associate human-readable names to Ceramic stream IDs or URLs
const modelAliases = {
schemas: {
BlogPost: 'ceramic://<schema URL>',
},
definitions: {},
tiles: {
examplePost: '<stream ID>',
},
}
const ceramic = new CeramicClient()
const model = new DataModel({ ceramic, model: modelAliases })
// The model exposes simple APIs over the provided model aliases
const blogPostSchemaURL = model.getSchemaURL('BlogPost')
// Individual tiles defined in the model aliases can be loaded using the alias
const examplePost = await model.loadTile('examplePost')
// New tiles can be created using the defined schema aliases
const newPost = await model.createTile('BlogPost', { title: 'new post', text: 'Hello world' })
维护者
- 保罗·勒卡姆(Paul Le Cam)@paullecam (英语)(中文(简体) )
许可证
麻省理工学院和Apache 2颁发双重许可证