Skip to content
This page View Markdown Open in ChatGPT Open in Claude

Distinct with query

The code in every language

Each example is the inside of main, written in every language API Maker runs : pick yours in the tabs, and every page shows it from then on. The types a call takes (GetAll, DeepItem…) are those of am : from am import GetAll in Python, use am::GetAll; in Rust, import am.GetAll; in Java and Kotlin ; PHP and C# have them without an import, Go names them am.GetAll.

g.sys.db.distinctQuery calls the distinct with query schema API of any table from your code, with the same headers and query parameters as over HTTP. It returns the data. The whole envelope (success, statusCode, data, totalCount, errors…) comes back when true is passed as the second argument in TypeScript, and through full in the other languages : g.sys.db.full (g.Sys.Db.Full in C# and Go, $g->sys->db->full in PHP).

Simple get distinctWithQuery

Simple distinctWithQuery
1
2
3
4
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name"
});
Simple distinctWithQuery
1
2
3
4
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
)
Simple distinctWithQuery
1
2
3
4
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
);
Simple distinctWithQuery
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name"));
Simple distinctWithQuery
1
2
3
4
5
6
7
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
})
if err != nil {
    return nil, err
}
Simple distinctWithQuery
let distinct_query = g.sys.db.distinct_query(Distinct::new("mysql_8", "inventory", "customers", "first_name"))?;
Simple distinctWithQuery
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name"));
Simple distinctWithQuery
val distinctQuery = g.sys.db.distinctQuery(Distinct("mysql_8", "inventory", "customers", "first_name"))

distinctWithQuery with multiple distinctField

distinctWithQuery with multiple distinctField
1
2
3
4
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name,last_name"
});
distinctWithQuery with multiple distinctField
1
2
3
4
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name,last_name',
)
distinctWithQuery with multiple distinctField
1
2
3
4
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name,last_name',
);
distinctWithQuery with multiple distinctField
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name,last_name"));
distinctWithQuery with multiple distinctField
1
2
3
4
5
6
7
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name,last_name",
})
if err != nil {
    return nil, err
}
distinctWithQuery with multiple distinctField
let distinct_query = g.sys.db.distinct_query(Distinct::new("mysql_8", "inventory", "customers", "first_name,last_name"))?;
distinctWithQuery with multiple distinctField
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name,last_name"));
distinctWithQuery with multiple distinctField
val distinctQuery = g.sys.db.distinctQuery(Distinct("mysql_8", "inventory", "customers", "first_name,last_name"))

distinctWithQuery with headers

distinctWithQuery with headers
1
2
3
4
5
6
7
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
distinctWithQuery with headers
1
2
3
4
5
6
7
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
)
distinctWithQuery with headers
1
2
3
4
5
6
7
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    ],
);
distinctWithQuery with headers
1
2
3
4
5
6
7
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
distinctWithQuery with headers
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Headers: am.M{
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with headers
1
2
3
4
5
6
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        })),
)?;
distinctWithQuery with headers
1
2
3
4
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .headers(Map.of(
        "x-am-response-case", "capitalCase" // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    )));
distinctWithQuery with headers
1
2
3
4
5
6
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        )),
)

distinctWithQuery with order

ascending

distinctWithQuery with ascending order
1
2
3
4
5
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    order: "asc"
});
distinctWithQuery with ascending order
1
2
3
4
5
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    order='asc',
)
distinctWithQuery with ascending order
1
2
3
4
5
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    order: 'asc',
);
distinctWithQuery with ascending order
1
2
3
4
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Order = "asc",
});
distinctWithQuery with ascending order
1
2
3
4
5
6
7
8
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Order:         "asc",
})
if err != nil {
    return nil, err
}
distinctWithQuery with ascending order
1
2
3
4
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .order("asc"),
)?;
distinctWithQuery with ascending order
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .order("asc"));
distinctWithQuery with ascending order
1
2
3
4
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .order("asc"),
)

descending

distinctWithQuery with descending order
1
2
3
4
5
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    order: "desc"
});
distinctWithQuery with descending order
1
2
3
4
5
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    order='desc',
)
distinctWithQuery with descending order
1
2
3
4
5
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    order: 'desc',
);
distinctWithQuery with descending order
1
2
3
4
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Order = "desc",
});
distinctWithQuery with descending order
1
2
3
4
5
6
7
8
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Order:         "desc",
})
if err != nil {
    return nil, err
}
distinctWithQuery with descending order
1
2
3
4
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .order("desc"),
)?;
distinctWithQuery with descending order
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .order("desc"));
distinctWithQuery with descending order
1
2
3
4
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .order("desc"),
)

distinctWithQuery with find

distinctWithQuery with find
1
2
3
4
5
6
7
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        first_name: "Bob"
    }
});
distinctWithQuery with find
1
2
3
4
5
6
7
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'first_name': 'Bob',
    },
)
distinctWithQuery with find
1
2
3
4
5
6
7
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'first_name' => 'Bob',
    ],
);
distinctWithQuery with find
1
2
3
4
5
6
7
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
});
distinctWithQuery with find
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "first_name": "Bob",
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with find
1
2
3
4
5
6
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "first_name": "Bob",
        })),
)?;
distinctWithQuery with find
1
2
3
4
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "first_name", "Bob"
    )));
distinctWithQuery with find
1
2
3
4
5
6
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "first_name" to "Bob",
        )),
)

$lt distinctWithQuery

distinctWithQuery with $lt
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$lt": 2
        }
    }
});
distinctWithQuery with $lt
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$lt': 2,
        },
    },
)
distinctWithQuery with $lt
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$lt' => 2,
        ],
    ],
);
distinctWithQuery with $lt
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$lt"] = 2,
        },
    },
});
distinctWithQuery with $lt
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$lt": 2,
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $lt
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$lt": 2,
            },
        })),
)?;
distinctWithQuery with $lt
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$lt", 2
        )
    )));
distinctWithQuery with $lt
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$lt" to 2,
            ),
        )),
)

$lte distinctWithQuery

distinctWithQuery with $lte
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$lte": 2
        }
    }
});
distinctWithQuery with $lte
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$lte': 2,
        },
    },
)
distinctWithQuery with $lte
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$lte' => 2,
        ],
    ],
);
distinctWithQuery with $lte
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$lte"] = 2,
        },
    },
});
distinctWithQuery with $lte
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$lte": 2,
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $lte
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$lte": 2,
            },
        })),
)?;
distinctWithQuery with $lte
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$lte", 2
        )
    )));
distinctWithQuery with $lte
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$lte" to 2,
            ),
        )),
)

$gt distinctWithQuery

distinctWithQuery with $gt
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$gt": 2
        }
    }
});
distinctWithQuery with $gt
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$gt': 2,
        },
    },
)
distinctWithQuery with $gt
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$gt' => 2,
        ],
    ],
);
distinctWithQuery with $gt
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$gt"] = 2,
        },
    },
});
distinctWithQuery with $gt
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$gt": 2,
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $gt
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$gt": 2,
            },
        })),
)?;
distinctWithQuery with $gt
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$gt", 2
        )
    )));
distinctWithQuery with $gt
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$gt" to 2,
            ),
        )),
)

$gte distinctWithQuery

distinctWithQuery with $gte
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$gte": 2
        }
    }
});
distinctWithQuery with $gte
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$gte': 2,
        },
    },
)
distinctWithQuery with $gte
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$gte' => 2,
        ],
    ],
);
distinctWithQuery with $gte
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$gte"] = 2,
        },
    },
});
distinctWithQuery with $gte
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$gte": 2,
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $gte
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$gte": 2,
            },
        })),
)?;
distinctWithQuery with $gte
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$gte", 2
        )
    )));
distinctWithQuery with $gte
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$gte" to 2,
            ),
        )),
)

$eq distinctWithQuery

distinctWithQuery with $eq
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$eq": 2
        }
    }
});
distinctWithQuery with $eq
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$eq': 2,
        },
    },
)
distinctWithQuery with $eq
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$eq' => 2,
        ],
    ],
);
distinctWithQuery with $eq
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$eq"] = 2,
        },
    },
});
distinctWithQuery with $eq
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$eq": 2,
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $eq
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$eq": 2,
            },
        })),
)?;
distinctWithQuery with $eq
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$eq", 2
        )
    )));
distinctWithQuery with $eq
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$eq" to 2,
            ),
        )),
)

$ne distinctWithQuery

distinctWithQuery with $ne
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$ne": 2
        }
    }
});
distinctWithQuery with $ne
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$ne': 2,
        },
    },
)
distinctWithQuery with $ne
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$ne' => 2,
        ],
    ],
);
distinctWithQuery with $ne
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$ne"] = 2,
        },
    },
});
distinctWithQuery with $ne
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$ne": 2,
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $ne
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$ne": 2,
            },
        })),
)?;
distinctWithQuery with $ne
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$ne", 2
        )
    )));
distinctWithQuery with $ne
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$ne" to 2,
            ),
        )),
)

$not distinctWithQuery

distinctWithQuery with $not
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$not": {
                "$in": [1,2,3]
            }
        }
    }
});
distinctWithQuery with $not
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$not': {
                '$in': [1, 2, 3],
            },
        },
    },
)
distinctWithQuery with $not
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$not' => [
                '$in' => [1, 2, 3],
            ],
        ],
    ],
);
distinctWithQuery with $not
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$not"] = new JsonObject
            {
                ["$in"] = new JsonArray { 1, 2, 3 },
            },
        },
    },
});
distinctWithQuery with $not
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$not": am.M{
                "$in": []any{1, 2, 3},
            },
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $not
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$not": {
                    "$in": [1, 2, 3],
                },
            },
        })),
)?;
distinctWithQuery with $not
1
2
3
4
5
6
7
8
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$not", Map.of(
                "$in", List.of(1, 2, 3)
            )
        )
    )));
distinctWithQuery with $not
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$not" to mapOf(
                    "\$in" to listOf(1, 2, 3),
                ),
            ),
        )),
)

$and distinctWithQuery

distinctWithQuery with $and
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        "$and": [
            {
                "customer_id": 1
            },
            {
                "zipcode": 382345
            }
        ]
    }
});
distinctWithQuery with $and
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        '$and': [
            {
                'customer_id': 1,
            },
            {
                'zipcode': 382345,
            },
        ],
    },
)
distinctWithQuery with $and
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        '$and' => [
            [
                'customer_id' => 1,
            ],
            [
                'zipcode' => 382345,
            ],
        ],
    ],
);
distinctWithQuery with $and
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["$and"] = new JsonArray
        {
            new JsonObject
            {
                ["customer_id"] = 1,
            },
            new JsonObject
            {
                ["zipcode"] = 382345,
            },
        },
    },
});
distinctWithQuery with $and
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "$and": []any{
            am.M{
                "customer_id": 1,
            },
            am.M{
                "zipcode": 382345,
            },
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $and
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "$and": [
                {
                    "customer_id": 1,
                },
                {
                    "zipcode": 382345,
                },
            ],
        })),
)?;
distinctWithQuery with $and
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "$and", List.of(
            Map.of(
                "customer_id", 1
            ),
            Map.of(
                "zipcode", 382345
            )
        )
    )));
distinctWithQuery with $and
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "\$and" to listOf(
                mapOf(
                    "customer_id" to 1,
                ),
                mapOf(
                    "zipcode" to 382345,
                ),
            ),
        )),
)

$or distinctWithQuery

distinctWithQuery with $or
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        "$or": [
            {
                "customer_id": 1
            },
            {
                "zipcode": 382345
            }
        ]
    }
});
distinctWithQuery with $or
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        '$or': [
            {
                'customer_id': 1,
            },
            {
                'zipcode': 382345,
            },
        ],
    },
)
distinctWithQuery with $or
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        '$or' => [
            [
                'customer_id' => 1,
            ],
            [
                'zipcode' => 382345,
            ],
        ],
    ],
);
distinctWithQuery with $or
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["$or"] = new JsonArray
        {
            new JsonObject
            {
                ["customer_id"] = 1,
            },
            new JsonObject
            {
                ["zipcode"] = 382345,
            },
        },
    },
});
distinctWithQuery with $or
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "$or": []any{
            am.M{
                "customer_id": 1,
            },
            am.M{
                "zipcode": 382345,
            },
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $or
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "$or": [
                {
                    "customer_id": 1,
                },
                {
                    "zipcode": 382345,
                },
            ],
        })),
)?;
distinctWithQuery with $or
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "$or", List.of(
            Map.of(
                "customer_id", 1
            ),
            Map.of(
                "zipcode", 382345
            )
        )
    )));
distinctWithQuery with $or
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "\$or" to listOf(
                mapOf(
                    "customer_id" to 1,
                ),
                mapOf(
                    "zipcode" to 382345,
                ),
            ),
        )),
)

$in distinctWithQuery

distinctWithQuery with $in
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$in": [1, 2,3]
        }
    }
});
distinctWithQuery with $in
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$in': [1, 2, 3],
        },
    },
)
distinctWithQuery with $in
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$in' => [1, 2, 3],
        ],
    ],
);
distinctWithQuery with $in
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$in"] = new JsonArray { 1, 2, 3 },
        },
    },
});
distinctWithQuery with $in
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$in": []any{1, 2, 3},
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $in
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$in": [1, 2, 3],
            },
        })),
)?;
distinctWithQuery with $in
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$in", List.of(1, 2, 3)
        )
    )));
distinctWithQuery with $in
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$in" to listOf(1, 2, 3),
            ),
        )),
)

$nin distinctWithQuery

distinctWithQuery with $nin
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        customer_id: {
            "$nin": [1, 2,3]
        }
    }
});
distinctWithQuery with $nin
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'customer_id': {
            '$nin': [1, 2, 3],
        },
    },
)
distinctWithQuery with $nin
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'customer_id' => [
            '$nin' => [1, 2, 3],
        ],
    ],
);
distinctWithQuery with $nin
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$nin"] = new JsonArray { 1, 2, 3 },
        },
    },
});
distinctWithQuery with $nin
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "customer_id": am.M{
            "$nin": []any{1, 2, 3},
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $nin
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "customer_id": {
                "$nin": [1, 2, 3],
            },
        })),
)?;
distinctWithQuery with $nin
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "customer_id", Map.of(
            "$nin", List.of(1, 2, 3)
        )
    )));
distinctWithQuery with $nin
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$nin" to listOf(1, 2, 3),
            ),
        )),
)

$like distinctWithQuery

distinctWithQuery with $like
1
2
3
4
5
6
7
8
9
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "mysql_8", database: "inventory", collection: "customers",
    distinctField: "first_name",
    find: {
        first_name: {
            "$like": "Bob%"
        }
    }
});
distinctWithQuery with $like
1
2
3
4
5
6
7
8
9
distinct_query = await g.sys.db.distinct_query(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find={
        'first_name': {
            '$like': 'Bob%',
        },
    },
)
distinctWithQuery with $like
1
2
3
4
5
6
7
8
9
$distinctQuery = $g->sys->db->distinctQuery(
    'mysql_8', 'inventory', 'customers',
    'first_name',
    find: [
        'first_name' => [
            '$like' => 'Bob%',
        ],
    ],
);
distinctWithQuery with $like
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["first_name"] = new JsonObject
        {
            ["$like"] = "Bob%",
        },
    },
});
distinctWithQuery with $like
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "first_name": am.M{
            "$like": "Bob%",
        },
    },
})
if err != nil {
    return nil, err
}
distinctWithQuery with $like
1
2
3
4
5
6
7
8
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("mysql_8", "inventory", "customers", "first_name")
        .find(json!({
            "first_name": {
                "$like": "Bob%",
            },
        })),
)?;
distinctWithQuery with $like
1
2
3
4
5
6
var distinctQuery = g.sys.db.distinctQuery(new Distinct("mysql_8", "inventory", "customers", "first_name")
    .find(Map.of(
        "first_name", Map.of(
            "$like", "Bob%"
        )
    )));
distinctWithQuery with $like
1
2
3
4
5
6
7
8
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("mysql_8", "inventory", "customers", "first_name")
        .find(mapOf(
            "first_name" to mapOf(
                "\$like" to "Bob%",
            ),
        )),
)

Structure

Distinct Query
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "INSTANCE_NAME", database: 'DB_NAME', collection: "COLLECTION_NAME",
    distinctField: "COLUMN_NAME",
    order: "asc", // asc | desc
    find: {
        "COLUMN_NAME": "VALUE",
    },
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type": "make_flat", // no_action | make_flat
        "x-am-meta": "true", // true, false
        "x-am-internationalization": "USER_I18N_ID",
        "x-am-run-in-sandbox": "2",
        "x-am-content-type-response": "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control": "reset_cache", // no_action | reset_cache
        "x-am-get-encrypted-data": "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout": "13000",
        "x-no-compression": "true", // true | false
        "x-am-encrypted-payload": "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
        // Authorization headers
        "x-am-authorization": "AUTHORIZATION_TOKEN",
        "x-am-user-authorization": "API_USER_TOKEN",
        "x-aws-authorization": "AWS_TOKEN",
        "x-google-authorization": "GOOGLE_TOKEN",
        "x-azure-authorization": "AZURE_TOKEN",
    },
});
Distinct Query
distinct_query = await g.sys.db.distinct_query(
    'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
    'COLUMN_NAME',
    order='asc',  # asc | desc
    find={
        'COLUMN_NAME': 'VALUE',
    },
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        'x-am-response-object-type': 'make_flat',  # no_action | make_flat
        'x-am-meta': 'true',  # true, false
        'x-am-internationalization': 'USER_I18N_ID',
        'x-am-run-in-sandbox': '2',
        'x-am-content-type-response': 'text/xml',  # application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        'x-am-cache-control': 'reset_cache',  # no_action | reset_cache
        'x-am-get-encrypted-data': 'get_only_encryption',  # no_encryption | get_only_encryption | get_data_and_encryption
        'x-am-sandbox-timeout': '13000',
        'x-no-compression': 'true',  # true | false
        'x-am-encrypted-payload': 'true',  # user will send 'true', when payload is encrypted for transfer
        # Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        'x-am-tenant-username': 'TENANT_USERNAME',  # ex: acme
        # Authorization headers
        'x-am-authorization': 'AUTHORIZATION_TOKEN',
        'x-am-user-authorization': 'API_USER_TOKEN',
        'x-aws-authorization': 'AWS_TOKEN',
        'x-google-authorization': 'GOOGLE_TOKEN',
        'x-azure-authorization': 'AZURE_TOKEN',
    },
)
Distinct Query
$distinctQuery = $g->sys->db->distinctQuery(
    'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
    'COLUMN_NAME',
    order: 'asc', // asc | desc
    find: [
        'COLUMN_NAME' => 'VALUE',
    ],
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        'x-am-response-object-type' => 'make_flat', // no_action | make_flat
        'x-am-meta' => 'true', // true, false
        'x-am-internationalization' => 'USER_I18N_ID',
        'x-am-run-in-sandbox' => '2',
        'x-am-content-type-response' => 'text/xml', // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        'x-am-cache-control' => 'reset_cache', // no_action | reset_cache
        'x-am-get-encrypted-data' => 'get_only_encryption', // no_encryption | get_only_encryption | get_data_and_encryption
        'x-am-sandbox-timeout' => '13000',
        'x-no-compression' => 'true', // true | false
        'x-am-encrypted-payload' => 'true', // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        'x-am-tenant-username' => 'TENANT_USERNAME', // ex: acme
        // Authorization headers
        'x-am-authorization' => 'AUTHORIZATION_TOKEN',
        'x-am-user-authorization' => 'API_USER_TOKEN',
        'x-aws-authorization' => 'AWS_TOKEN',
        'x-google-authorization' => 'GOOGLE_TOKEN',
        'x-azure-authorization' => 'AZURE_TOKEN',
    ],
);
Distinct Query
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME", "COLUMN_NAME")
{
    Order = "asc", // asc | desc
    Find = new JsonObject
    {
        ["COLUMN_NAME"] = "VALUE",
    },
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        ["x-am-response-object-type"] = "make_flat", // no_action | make_flat
        ["x-am-meta"] = "true", // true, false
        ["x-am-internationalization"] = "USER_I18N_ID",
        ["x-am-run-in-sandbox"] = "2",
        ["x-am-content-type-response"] = "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        ["x-am-cache-control"] = "reset_cache", // no_action | reset_cache
        ["x-am-get-encrypted-data"] = "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        ["x-am-sandbox-timeout"] = "13000",
        ["x-no-compression"] = "true", // true | false
        ["x-am-encrypted-payload"] = "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        ["x-am-tenant-username"] = "TENANT_USERNAME", // ex: acme
        // Authorization headers
        ["x-am-authorization"] = "AUTHORIZATION_TOKEN",
        ["x-am-user-authorization"] = "API_USER_TOKEN",
        ["x-aws-authorization"] = "AWS_TOKEN",
        ["x-google-authorization"] = "GOOGLE_TOKEN",
        ["x-azure-authorization"] = "AZURE_TOKEN",
    },
});
Distinct Query
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "INSTANCE_NAME", Database: "DB_NAME", Collection: "COLLECTION_NAME",
    DistinctField: "COLUMN_NAME",
    Order:         "asc", // asc | desc
    Find: am.M{
        "COLUMN_NAME": "VALUE",
    },
    Headers: am.M{
        "x-am-response-case":         "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type":  "make_flat",   // no_action | make_flat
        "x-am-meta":                  "true",        // true, false
        "x-am-internationalization":  "USER_I18N_ID",
        "x-am-run-in-sandbox":        "2",
        "x-am-content-type-response": "text/xml",            // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control":         "reset_cache",         // no_action | reset_cache
        "x-am-get-encrypted-data":    "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout":       "13000",
        "x-no-compression":           "true", // true | false
        "x-am-encrypted-payload":     "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
        // Authorization headers
        "x-am-authorization":      "AUTHORIZATION_TOKEN",
        "x-am-user-authorization": "API_USER_TOKEN",
        "x-aws-authorization":     "AWS_TOKEN",
        "x-google-authorization":  "GOOGLE_TOKEN",
        "x-azure-authorization":   "AZURE_TOKEN",
    },
})
if err != nil {
    return nil, err
}
Distinct Query
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME", "COLUMN_NAME")
        .order("asc") // asc | desc
        .find(json!({
            "COLUMN_NAME": "VALUE",
        }))
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
            "x-am-response-object-type": "make_flat", // no_action | make_flat
            "x-am-meta": "true", // true, false
            "x-am-internationalization": "USER_I18N_ID",
            "x-am-run-in-sandbox": "2",
            "x-am-content-type-response": "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
            "x-am-cache-control": "reset_cache", // no_action | reset_cache
            "x-am-get-encrypted-data": "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
            "x-am-sandbox-timeout": "13000",
            "x-no-compression": "true", // true | false
            "x-am-encrypted-payload": "true", // user will send 'true', when payload is encrypted for transfer
            // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
            "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
            // Authorization headers
            "x-am-authorization": "AUTHORIZATION_TOKEN",
            "x-am-user-authorization": "API_USER_TOKEN",
            "x-aws-authorization": "AWS_TOKEN",
            "x-google-authorization": "GOOGLE_TOKEN",
            "x-azure-authorization": "AZURE_TOKEN",
        })),
)?;
Distinct Query
var distinctQuery = g.sys.db.distinctQuery(new Distinct("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME", "COLUMN_NAME")
    .order("asc") // asc | desc
    .find(Map.of(
        "COLUMN_NAME", "VALUE"
    ))
    .headers(JsonObject.of(
        "x-am-response-case", "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type", "make_flat", // no_action | make_flat
        "x-am-meta", "true", // true, false
        "x-am-internationalization", "USER_I18N_ID",
        "x-am-run-in-sandbox", "2",
        "x-am-content-type-response", "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control", "reset_cache", // no_action | reset_cache
        "x-am-get-encrypted-data", "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout", "13000",
        "x-no-compression", "true", // true | false
        "x-am-encrypted-payload", "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username", "TENANT_USERNAME", // ex: acme
        // Authorization headers
        "x-am-authorization", "AUTHORIZATION_TOKEN",
        "x-am-user-authorization", "API_USER_TOKEN",
        "x-aws-authorization", "AWS_TOKEN",
        "x-google-authorization", "GOOGLE_TOKEN",
        "x-azure-authorization", "AZURE_TOKEN"
    )));
Distinct Query
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME", "COLUMN_NAME")
        .order("asc") // asc | desc
        .find(mapOf(
            "COLUMN_NAME" to "VALUE",
        ))
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
            "x-am-response-object-type" to "make_flat", // no_action | make_flat
            "x-am-meta" to "true", // true, false
            "x-am-internationalization" to "USER_I18N_ID",
            "x-am-run-in-sandbox" to "2",
            "x-am-content-type-response" to "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
            "x-am-cache-control" to "reset_cache", // no_action | reset_cache
            "x-am-get-encrypted-data" to "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
            "x-am-sandbox-timeout" to "13000",
            "x-no-compression" to "true", // true | false
            "x-am-encrypted-payload" to "true", // user will send 'true', when payload is encrypted for transfer
            // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
            "x-am-tenant-username" to "TENANT_USERNAME", // ex: acme
            // Authorization headers
            "x-am-authorization" to "AUTHORIZATION_TOKEN",
            "x-am-user-authorization" to "API_USER_TOKEN",
            "x-aws-authorization" to "AWS_TOKEN",
            "x-google-authorization" to "GOOGLE_TOKEN",
            "x-azure-authorization" to "AZURE_TOKEN",
        )),
)

Multi-tenant

  • instance: "crm::acme" works on the database of the tenant acme of the multi-tenant instance crm.
  • With instance: "crm", the call works on the database of the tenant of the request: a custom API called with the x-am-tenant-username header passes it on to the APIs it calls. A request without a tenant works on the structure database.
Distinct first names of some customers of the tenant acme
1
2
3
4
5
6
7
let distinctQuery = await g.sys.db.distinctQuery({
    instance: "crm::acme", database: "crm", collection: "customers",
    distinctField: "first_name",
    find: {
        "last_name": "Lin"
    }
});
Distinct first names of some customers of the tenant acme
1
2
3
4
5
6
7
distinct_query = await g.sys.db.distinct_query(
    'crm::acme', 'crm', 'customers',
    'first_name',
    find={
        'last_name': 'Lin',
    },
)
Distinct first names of some customers of the tenant acme
1
2
3
4
5
6
7
$distinctQuery = $g->sys->db->distinctQuery(
    'crm::acme', 'crm', 'customers',
    'first_name',
    find: [
        'last_name' => 'Lin',
    ],
);
Distinct first names of some customers of the tenant acme
1
2
3
4
5
6
7
var distinctQuery = await g.Sys.Db.DistinctQuery(new Distinct("crm::acme", "crm", "customers", "first_name")
{
    Find = new JsonObject
    {
        ["last_name"] = "Lin",
    },
});
Distinct first names of some customers of the tenant acme
distinctQuery, err := g.Sys.Db.DistinctQuery(am.Distinct{
    Instance: "crm::acme", Database: "crm", Collection: "customers",
    DistinctField: "first_name",
    Find: am.M{
        "last_name": "Lin",
    },
})
if err != nil {
    return nil, err
}
Distinct first names of some customers of the tenant acme
1
2
3
4
5
6
let distinct_query = g.sys.db.distinct_query(
    Distinct::new("crm::acme", "crm", "customers", "first_name")
        .find(json!({
            "last_name": "Lin",
        })),
)?;
Distinct first names of some customers of the tenant acme
1
2
3
4
var distinctQuery = g.sys.db.distinctQuery(new Distinct("crm::acme", "crm", "customers", "first_name")
    .find(Map.of(
        "last_name", "Lin"
    )));
Distinct first names of some customers of the tenant acme
1
2
3
4
5
6
val distinctQuery = g.sys.db.distinctQuery(
    Distinct("crm::acme", "crm", "customers", "first_name")
        .find(mapOf(
            "last_name" to "Lin",
        )),
)

Without a schema

g.sys.db.gen.distinctQueryGen takes the same arguments and calls the distinct with query generated API : no schema, so the data is read and written as it is in the table, without the conversions, validations and defaults of the schema.

Language The call
TypeScript g.sys.db.gen.distinctQueryGen(…)
Python g.sys.db.gen.distinct_query_gen(…)
PHP $g->sys->db->gen->distinctQueryGen(…)
C#, Go g.Sys.Db.Gen.DistinctQueryGen(…)
Rust g.sys.db.distinct_query_gen(Distinct::new(…))
Java, Kotlin g.sys.db.gen.distinctQueryGen(…)