export namespace connection { export class UpdateRow { keys: Record; values: Record; static createFrom(source: any = {}) { return new UpdateRow(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.keys = source["keys"]; this.values = source["values"]; } } export class ChangeSet { inserts: any[]; updates: UpdateRow[]; deletes: any[]; static createFrom(source: any = {}) { return new ChangeSet(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.inserts = source["inserts"]; this.updates = this.convertValues(source["updates"], UpdateRow); this.deletes = source["deletes"]; } convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; } if (a.slice && a.map) { return (a as any[]).map(elem => this.convertValues(elem, classs)); } else if ("object" === typeof a) { if (asMap) { for (const key of Object.keys(a)) { a[key] = new classs(a[key]); } return a; } return new classs(a); } return a; } } export class SSHConfig { host: string; port: number; user: string; password: string; keyPath: string; static createFrom(source: any = {}) { return new SSHConfig(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.host = source["host"]; this.port = source["port"]; this.user = source["user"]; this.password = source["password"]; this.keyPath = source["keyPath"]; } } export class ConnectionConfig { type: string; host: string; port: number; user: string; password: string; database: string; useSSH: boolean; ssh: SSHConfig; static createFrom(source: any = {}) { return new ConnectionConfig(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.type = source["type"]; this.host = source["host"]; this.port = source["port"]; this.user = source["user"]; this.password = source["password"]; this.database = source["database"]; this.useSSH = source["useSSH"]; this.ssh = this.convertValues(source["ssh"], SSHConfig); } convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; } if (a.slice && a.map) { return (a as any[]).map(elem => this.convertValues(elem, classs)); } else if ("object" === typeof a) { if (asMap) { for (const key of Object.keys(a)) { a[key] = new classs(a[key]); } return a; } return new classs(a); } return a; } } export class QueryResult { success: boolean; message: string; data: any; fields?: string[]; static createFrom(source: any = {}) { return new QueryResult(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.success = source["success"]; this.message = source["message"]; this.data = source["data"]; this.fields = source["fields"]; } } }