我的数据在RethinkDb中看起来像这样:
grep "a.*b" file
在客户端上,我想获取约会并将造型师嵌入约会对象中,如下所示:
[appointments]
{
id: 1,
date: "2016-01-01",
stylistId: 1,
}
[stylists]
{
id: 1,
name: "Sue",
}
我可以使用此查询实现一些目标:
{
id: 1,
date: "2016-01-01",
stylist: {
id: 1,
name: "Sue",
}
}
我想知道是否有更简洁的方法来达到预期的效果。我知道RethinkDb支持Joins但它看起来并不像是在Horizon中暴露出来的。我对RxJS也不是很了解,所以我想知道是否可以在那里更干净地完成连接。
答案 0 :(得分:2)
尝试import Draft from 'draft-js';
import DraftPasteProcessor from 'draft-js/lib/DraftPasteProcessor';
const { EditorState, ContentState } = Draft;
import Editor from 'draft-js-plugins-editor';
import createRichButtonsPlugin from 'draft-js-richbuttons-plugin';
const richButtonsPlugin = createRichButtonsPlugin();
class DescriptionForm extends React.Component {
state = {
editorState: this._getPlaceholder(),
}
_getPlaceholder() {
const placeholder = 'Write something here';
const contentHTML = DraftPasteProcessor.processHTML(placeholder);
const state = ContentState.createFromBlockArray(contentHTML);
return Draft.EditorState.createWithContent(state);
}
_onChange(editorState) {
this.setState({
editorState,
});
}
render () {
let { editorState } = this.state;
return (
<div>
<Editor
editorState={editorState}
onChange={this._onChange.bind(this)}
spellCheck={false}
plugins={[richButtonsPlugin, videoPlugin]}
/>
</div>
);
}
}
和mergeMap
组合
map
我在这里写下了它,所以它未经测试,但它应该以某种方式工作