我们经常定义这样的架构
Do Until EndOfStream '= True
Dim line_to_speak As String = sReader.ReadLine
Dim vc = Mid(line_to_speak, 1, 1) <- you dont need this
Select Case vc <- you dont need this
Case Is = "/" <- you dont need this
voice_index = Val(Mid(line_to_speak, 2, 2)) <- you dont need this
srate = Val(Mid(line_to_speak, 5, 2)) <- you dont need this
edassistv.lstVoices.SelectedIndex = voice_index <- you dont need this
selected_voice = edassistv.lstVoices.SelectedItem <- you dont need this
Case Else<- you dont need this
synth.SelectVoice(selected_voice)
synth.Speak(line_to_speak)
End Select<- you dont need this
Loop
Catch ex As Exception
GoTo finish
我们必须传入与模式匹配的对象,否则无效。但我说要保存一些动态的东西,我甚至不知道它们是什么,例如它可以
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var Account = new Schema({
username: String,
password: String
});
module.exports = mongoose.model('account', Account);
或其他任何东西
{'name':'something',birthday:'1980-3-01'}
那么如何设置架构呢?
答案 0 :(得分:1)
Mongoose有Mixed
schema type,允许字段为任何对象。
var Account = new Schema({
username: String,
password: String,
anyobject: Schema.Types.Mixed
});
答案 1 :(得分:1)
您可以在现有架构定义中使用func sceneViewPannedOneFinger(sender: UIPanGestureRecognizer) {
// Get pan distance & convert to radians
let translation = sender.translationInView(sender.view!)
var xRadians = GLKMathDegreesToRadians(Float(translation.x))
var yRadians = GLKMathDegreesToRadians(Float(translation.y))
// Get x & y radians
xRadians = (xRadians / 4) + curXRadians
yRadians = (yRadians / 4) + curYRadians
// Limit yRadians to prevent rotating 360 degrees vertically
yRadians = max(Float(-M_PI_2), min(Float(M_PI_2), yRadians))
// Set rotation values to avoid Gimbal Lock
cameraNode.rotation = SCNVector4(x: 1, y: 0, z: 0, w: yRadians)
userNode.rotation = SCNVector4(x: 0, y: 1, z: 0, w: xRadians)
// Save value for next rotation
if sender.state == UIGestureRecognizerState.Ended {
curXRadians = xRadians
curYRadians = yRadians
}
// Set preview block
setPreviewBlock(sender)
}
private func setPreviewBlock(recognizer: UIGestureRecognizer) {
let point = recognizer.locationInView(sceneView)
let options = [SCNHitTestRootNodeKey: sceneView.scene!.rootNode, SCNHitTestClipToZRangeKey: 15, SCNHitTestSortResultsKey: true]
let hits = sceneView.hitTest(point, options: options)
print(hits.first?.worldCoordinates)
}
选项,方法是将其作为strict: false
构造函数中的第二个参数提供:
示例强>
Schema
您还可以使用var AccountSchema = new Schema({
Name : {type: String},
Password : {type: String}
}, {strict: false});
module.exports = mongoose.model('Account', AccountSchema);
类型
Mixed