ModelQuery: fix array of values to string conversion
This commit is contained in:
parent
fed54b9483
commit
813e10c4c7
@ -265,7 +265,9 @@ class FieldValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public toString(first: boolean = true): string {
|
public toString(first: boolean = true): string {
|
||||||
return `${!first ? ',' : ''}${this.field}${this.test}${this.raw || this.value === null || this.value instanceof ModelQuery ? this.value : (Array.isArray(this.value) ? '(?)' : '?')}`;
|
const valueStr = this.raw || this.value === null || this.value instanceof ModelQuery ? this.value :
|
||||||
|
(Array.isArray(this.value) ? `(${'?'.repeat(this.value.length).split('').join(',')})` : '?');
|
||||||
|
return `${!first ? ',' : ''}${this.field}${this.test}${valueStr}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected get test(): string {
|
protected get test(): string {
|
||||||
@ -275,6 +277,7 @@ class FieldValue {
|
|||||||
public get variables(): any[] {
|
public get variables(): any[] {
|
||||||
if (this.value instanceof ModelQuery) return this.value.variables;
|
if (this.value instanceof ModelQuery) return this.value.variables;
|
||||||
if (this.raw || this.value === null) return [];
|
if (this.raw || this.value === null) return [];
|
||||||
|
if (Array.isArray(this.value)) return this.value;
|
||||||
return [this.value];
|
return [this.value];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user