项目作者: yo8568

项目描述 :
Generating GAQL (Google Ads Query Language) tool.
高级语言: JavaScript
项目地址: git://github.com/yo8568/js-gaql-builder.git
创建时间: 2019-07-10T06:31:05Z
项目社区:https://github.com/yo8568/js-gaql-builder

开源协议:

下载


GAQL Builder - javascript version

build

Generating GAQL (Google Ads Query Language) tool, this is not official library.
If you want to build GAQL string much easier, you can use this tool, but it would not be validated entirely for all of posible combinations.

Please follow the building rule via official documentation.

Installation

  1. $ npm install js-gaql-builder

Usage

Import library

  1. // node.js or es5
  2. const GAQLB = require('js-gaql-builder').default
  3. // react.js or es6
  4. import GAQLB from 'js-gaql-builder'

Syntax

  1. const result = new GAQLB()
  2. .select([
  3. 'ad_group.id', 'ad_group_criterion.type', 'ad_group_criterion.criterion_id',
  4. 'ad_group_criterion.keyword.text', 'ad_group_criterion.keyword.match_type'])
  5. .from('ad_group_criterion')
  6. .where('metrics.clicks > 135')
  7. .parameters(['include_drafts = true'])
  8. .orderBy('ASC')
  9. .limit(2)
  10. .toString()

Result

  1. SELECT
  2. ad_group.id,
  3. ad_group_criterion.type,
  4. ad_group_criterion.criterion_id,
  5. ad_group_criterion.keyword.text,
  6. ad_group_criterion.keyword.match_type
  7. FROM
  8. ad_group_criterion
  9. WHERE
  10. metrics.clicks > 135
  11. ORDER BY
  12. ASC
  13. LIMIT
  14. 2
  15. PARAMETERS
  16. include_drafts = true

Run Test

Test

  1. $ npm run test

Converage

  1. $ npm run cov

Licence

MIT