Code examples
/
Database APIs (g.sys.db)
Count
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.count calls the count 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 count
TypeScript Python PHP C# Go Rust Java Kotlin
Simple get count let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
});
Simple get count count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
)
Simple get count $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
);
Simple get count var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" ));
Simple get count count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
})
if err != nil {
return nil , err
}
Simple get count let count = g . sys . db . count ( Count :: new ( "mysql_8" , "inventory" , "customers" )) ? ;
Simple get count var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" ));
Simple get count val count = g . sys . db . count ( Count ( "mysql_8" , "inventory" , "customers" ))
TypeScript Python PHP C# Go Rust Java Kotlin
get count with headers let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
headers : {
"x-am-response-case" : "capitalCase" , // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
},
});
get count with headers count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
headers = {
'x-am-response-case' : 'capitalCase' , # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
},
)
get count with headers $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
headers: [
'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
],
);
get count with headers var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Headers = new JsonObject
{
["x-am-response-case"] = "capitalCase" , // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
},
});
get count with headers count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
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
}
get count with headers let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. headers ( json ! ({
"x-am-response-case" : "capitalCase" , // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
})),
) ? ;
get count with headers var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. headers ( Map . of (
"x-am-response-case" , "capitalCase" // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
)));
get count with headers val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. headers ( mapOf (
"x-am-response-case" to "capitalCase" , // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
)),
)
get count [find]
TypeScript Python PHP C# Go Rust Java Kotlin
Simple find let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"first_name" : "Bob"
}
});
Simple find count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'first_name' : 'Bob' ,
},
)
Simple find $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'first_name' => 'Bob',
],
);
Simple find var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["first_name"] = "Bob" ,
},
});
Simple find count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"first_name" : "Bob" ,
},
})
if err != nil {
return nil , err
}
Simple find let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"first_name" : "Bob" ,
})),
) ? ;
Simple find var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"first_name" , "Bob"
)));
Simple find val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"first_name" to "Bob" ,
)),
)
$gt
TypeScript Python PHP C# Go Rust Java Kotlin
$gt let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"customer_id" : {
"$gt" : 4
}
}
});
$gt count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'customer_id' : {
'$gt' : 4 ,
},
},
)
$gt $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'customer_id' => [
'$gt' => 4,
],
],
);
$gt var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["customer_id"] = new JsonObject
{
["$gt"] = 4 ,
},
},
});
$gt count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"customer_id" : am . M {
"$gt" : 4 ,
},
},
})
if err != nil {
return nil , err
}
$gt let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"customer_id" : {
"$gt" : 4 ,
},
})),
) ? ;
$gt var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"customer_id" , Map . of (
"$gt" , 4
)
)));
$gt val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"customer_id" to mapOf (
"\ $ gt " to 4 ,
),
)),
)
$gte
TypeScript Python PHP C# Go Rust Java Kotlin
$gte let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"customer_id" : {
"$gte" : 4
}
}
});
$gte count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'customer_id' : {
'$gte' : 4 ,
},
},
)
$gte $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'customer_id' => [
'$gte' => 4,
],
],
);
$gte var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["customer_id"] = new JsonObject
{
["$gte"] = 4 ,
},
},
});
$gte count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"customer_id" : am . M {
"$gte" : 4 ,
},
},
})
if err != nil {
return nil , err
}
$gte let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"customer_id" : {
"$gte" : 4 ,
},
})),
) ? ;
$gte var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"customer_id" , Map . of (
"$gte" , 4
)
)));
$gte val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"customer_id" to mapOf (
"\ $ gte " to 4 ,
),
)),
)
$lt
TypeScript Python PHP C# Go Rust Java Kotlin
$lt let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"customer_id" : {
"$lt" : 4
}
}
});
$lt count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'customer_id' : {
'$lt' : 4 ,
},
},
)
$lt $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'customer_id' => [
'$lt' => 4,
],
],
);
$lt var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["customer_id"] = new JsonObject
{
["$lt"] = 4 ,
},
},
});
$lt count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"customer_id" : am . M {
"$lt" : 4 ,
},
},
})
if err != nil {
return nil , err
}
$lt let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"customer_id" : {
"$lt" : 4 ,
},
})),
) ? ;
$lt var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"customer_id" , Map . of (
"$lt" , 4
)
)));
$lt val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"customer_id" to mapOf (
"\ $ lt " to 4 ,
),
)),
)
$lte
TypeScript Python PHP C# Go Rust Java Kotlin
$lte let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"customer_id" : {
"$lte" : 4
}
}
});
$lte count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'customer_id' : {
'$lte' : 4 ,
},
},
)
$lte $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'customer_id' => [
'$lte' => 4,
],
],
);
$lte var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["customer_id"] = new JsonObject
{
["$lte"] = 4 ,
},
},
});
$lte count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"customer_id" : am . M {
"$lte" : 4 ,
},
},
})
if err != nil {
return nil , err
}
$lte let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"customer_id" : {
"$lte" : 4 ,
},
})),
) ? ;
$lte var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"customer_id" , Map . of (
"$lte" , 4
)
)));
$lte val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"customer_id" to mapOf (
"\ $ lte " to 4 ,
),
)),
)
$eq
TypeScript Python PHP C# Go Rust Java Kotlin
$eq let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"first_name" : {
"$eq" : "Bob"
}
}
});
$eq count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'first_name' : {
'$eq' : 'Bob' ,
},
},
)
$eq $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'first_name' => [
'$eq' => 'Bob',
],
],
);
$eq var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["first_name"] = new JsonObject
{
["$eq"] = "Bob" ,
},
},
});
$eq count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"first_name" : am . M {
"$eq" : "Bob" ,
},
},
})
if err != nil {
return nil , err
}
$eq let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"first_name" : {
"$eq" : "Bob" ,
},
})),
) ? ;
$eq var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"first_name" , Map . of (
"$eq" , "Bob"
)
)));
$eq val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"first_name" to mapOf (
"\ $ eq " to "Bob" ,
),
)),
)
$ne
TypeScript Python PHP C# Go Rust Java Kotlin
$ne let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"first_name" : {
"$ne" : "Bob"
}
}
});
$ne count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'first_name' : {
'$ne' : 'Bob' ,
},
},
)
$ne $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'first_name' => [
'$ne' => 'Bob',
],
],
);
$ne var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["first_name"] = new JsonObject
{
["$ne"] = "Bob" ,
},
},
});
$ne count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"first_name" : am . M {
"$ne" : "Bob" ,
},
},
})
if err != nil {
return nil , err
}
$ne let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"first_name" : {
"$ne" : "Bob" ,
},
})),
) ? ;
$ne var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"first_name" , Map . of (
"$ne" , "Bob"
)
)));
$ne val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"first_name" to mapOf (
"\ $ ne " to "Bob" ,
),
)),
)
$in
TypeScript Python PHP C# Go Rust Java Kotlin
$in let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"customer_id" : {
"$in" : [ 1 , 2 ]
}
}
});
$in count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'customer_id' : {
'$in' : [ 1 , 2 ],
},
},
)
$in $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'customer_id' => [
'$in' => [1, 2],
],
],
);
$in var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["customer_id"] = new JsonObject
{
["$in"] = new JsonArray { 1 , 2 },
},
},
});
$in count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"customer_id" : am . M {
"$in" : [] any { 1 , 2 },
},
},
})
if err != nil {
return nil , err
}
$in let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"customer_id" : {
"$in" : [ 1 , 2 ],
},
})),
) ? ;
$in var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"customer_id" , Map . of (
"$in" , List . of ( 1 , 2 )
)
)));
$in val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"customer_id" to mapOf (
"\ $ in " to listOf ( 1 , 2 ),
),
)),
)
$nin
TypeScript Python PHP C# Go Rust Java Kotlin
$nin let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"customer_id" : {
"$nin" : [ 1 , 2 ]
}
}
});
$nin count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'customer_id' : {
'$nin' : [ 1 , 2 ],
},
},
)
$nin $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'customer_id' => [
'$nin' => [1, 2],
],
],
);
$nin var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["customer_id"] = new JsonObject
{
["$nin"] = new JsonArray { 1 , 2 },
},
},
});
$nin count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"customer_id" : am . M {
"$nin" : [] any { 1 , 2 },
},
},
})
if err != nil {
return nil , err
}
$nin let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"customer_id" : {
"$nin" : [ 1 , 2 ],
},
})),
) ? ;
$nin var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"customer_id" , Map . of (
"$nin" , List . of ( 1 , 2 )
)
)));
$nin val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"customer_id" to mapOf (
"\ $ nin " to listOf ( 1 , 2 ),
),
)),
)
$and
TypeScript Python PHP C# Go Rust Java Kotlin
$and let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"$and" : [
{
"employee_Details.emp_Id" : 1
},
{
"city" : "Baroda"
}
]
}
});
$and count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'$and' : [
{
'employee_Details.emp_Id' : 1 ,
},
{
'city' : 'Baroda' ,
},
],
},
)
$and $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'$and' => [
[
'employee_Details.emp_Id' => 1,
],
[
'city' => 'Baroda',
],
],
],
);
$and var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["$and"] = new JsonArray
{
new JsonObject
{
["employee_Details.emp_Id"] = 1 ,
},
new JsonObject
{
["city"] = "Baroda" ,
},
},
},
});
$and count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"$and" : [] any {
am . M {
"employee_Details.emp_Id" : 1 ,
},
am . M {
"city" : "Baroda" ,
},
},
},
})
if err != nil {
return nil , err
}
$and let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"$and" : [
{
"employee_Details.emp_Id" : 1 ,
},
{
"city" : "Baroda" ,
},
],
})),
) ? ;
$and var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"$and" , List . of (
Map . of (
"employee_Details.emp_Id" , 1
),
Map . of (
"city" , "Baroda"
)
)
)));
$and val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"\ $ and " to listOf (
mapOf (
"employee_Details.emp_Id" to 1 ,
),
mapOf (
"city" to "Baroda" ,
),
),
)),
)
$or
TypeScript Python PHP C# Go Rust Java Kotlin
$or let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"$or" : [
{
"state" : "Gujarat"
},
{
"city" : "Baroda"
}
]
}
});
$or count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'$or' : [
{
'state' : 'Gujarat' ,
},
{
'city' : 'Baroda' ,
},
],
},
)
$or $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'$or' => [
[
'state' => 'Gujarat',
],
[
'city' => 'Baroda',
],
],
],
);
$or var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["$or"] = new JsonArray
{
new JsonObject
{
["state"] = "Gujarat" ,
},
new JsonObject
{
["city"] = "Baroda" ,
},
},
},
});
$or count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"$or" : [] any {
am . M {
"state" : "Gujarat" ,
},
am . M {
"city" : "Baroda" ,
},
},
},
})
if err != nil {
return nil , err
}
$or let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"$or" : [
{
"state" : "Gujarat" ,
},
{
"city" : "Baroda" ,
},
],
})),
) ? ;
$or var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"$or" , List . of (
Map . of (
"state" , "Gujarat"
),
Map . of (
"city" , "Baroda"
)
)
)));
$or val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"\ $ or " to listOf (
mapOf (
"state" to "Gujarat" ,
),
mapOf (
"city" to "Baroda" ,
),
),
)),
)
$like
TypeScript Python PHP C# Go Rust Java Kotlin
$like let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"first_name" : {
"$like" : "%Mall%"
}
}
});
$like count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'first_name' : {
'$like' : '%Mall%' ,
},
},
)
$like $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'first_name' => [
'$like' => '%Mall%',
],
],
);
$like var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["first_name"] = new JsonObject
{
["$like"] = "%Mall%" ,
},
},
});
$like count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"first_name" : am . M {
"$like" : "%Mall%" ,
},
},
})
if err != nil {
return nil , err
}
$like let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"first_name" : {
"$like" : "%Mall%" ,
},
})),
) ? ;
$like var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"first_name" , Map . of (
"$like" , "%Mall%"
)
)));
$like val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"first_name" to mapOf (
"\ $ like " to "%Mall%" ,
),
)),
)
floating value support
TypeScript Python PHP C# Go Rust Java Kotlin
floating value support let count = await g . sys . db . count ({
instance : "mysql_8" , database : "inventory" , collection : "customers" ,
find : {
"customer_id" : {
"$gt" : 2.2
}
}
});
floating value support count = await g . sys . db . count (
'mysql_8' , 'inventory' , 'customers' ,
find = {
'customer_id' : {
'$gt' : 2.2 ,
},
},
)
floating value support $count = $g->sys->db->count(
'mysql_8', 'inventory', 'customers',
find: [
'customer_id' => [
'$gt' => 2.2,
],
],
);
floating value support var count = await g . Sys . Db . Count ( new Count ( "mysql_8" , "inventory" , "customers" )
{
Find = new JsonObject
{
["customer_id"] = new JsonObject
{
["$gt"] = 2.2 ,
},
},
});
floating value support count , err := g . Sys . Db . Count ( am . Count {
Instance : "mysql_8" , Database : "inventory" , Collection : "customers" ,
Find : am . M {
"customer_id" : am . M {
"$gt" : 2.2 ,
},
},
})
if err != nil {
return nil , err
}
floating value support let count = g . sys . db . count (
Count :: new ( "mysql_8" , "inventory" , "customers" )
. find ( json ! ({
"customer_id" : {
"$gt" : 2.2 ,
},
})),
) ? ;
floating value support var count = g . sys . db . count ( new Count ( "mysql_8" , "inventory" , "customers" )
. find ( Map . of (
"customer_id" , Map . of (
"$gt" , 2.2
)
)));
floating value support val count = g . sys . db . count (
Count ( "mysql_8" , "inventory" , "customers" )
. find ( mapOf (
"customer_id" to mapOf (
"\ $ gt " to 2.2 ,
),
)),
)
Structure
TypeScript Python PHP C# Go Rust Java Kotlin
Count method let count = await g . sys . db . count ({
instance : "INSTANCE_NAME" , database : 'DB_NAME' , collection : "COLLECTION_NAME" ,
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" ,
},
});
Count method count = await g . sys . db . count (
'INSTANCE_NAME' , 'DB_NAME' , 'COLLECTION_NAME' ,
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' ,
},
)
Count method $count = $g->sys->db->count(
'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
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',
],
);
Count method var count = await g . Sys . Db . Count ( new Count ( "INSTANCE_NAME" , "DB_NAME" , "COLLECTION_NAME" )
{
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" ,
},
});
Count method count , err := g . Sys . Db . Count ( am . Count {
Instance : "INSTANCE_NAME" , Database : "DB_NAME" , Collection : "COLLECTION_NAME" ,
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
}
Count method let count = g . sys . db . count (
Count :: new ( "INSTANCE_NAME" , "DB_NAME" , "COLLECTION_NAME" )
. 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" ,
})),
) ? ;
Count method var count = g . sys . db . count ( new Count ( "INSTANCE_NAME" , "DB_NAME" , "COLLECTION_NAME" )
. 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"
)));
Count method val count = g . sys . db . count (
Count ( "INSTANCE_NAME" , "DB_NAME" , "COLLECTION_NAME" )
. 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.
TypeScript Python PHP C# Go Rust Java Kotlin
Count the customers of the tenant acme let count = await g . sys . db . count ({
instance : "crm::acme" , database : "crm" , collection : "customers" ,
find : {
"first_name" : "Bob"
}
});
Count the customers of the tenant acme count = await g . sys . db . count (
'crm::acme' , 'crm' , 'customers' ,
find = {
'first_name' : 'Bob' ,
},
)
Count the customers of the tenant acme $count = $g->sys->db->count(
'crm::acme', 'crm', 'customers',
find: [
'first_name' => 'Bob',
],
);
Count the customers of the tenant acme var count = await g . Sys . Db . Count ( new Count ( "crm::acme" , "crm" , "customers" )
{
Find = new JsonObject
{
["first_name"] = "Bob" ,
},
});
Count the customers of the tenant acme count , err := g . Sys . Db . Count ( am . Count {
Instance : "crm::acme" , Database : "crm" , Collection : "customers" ,
Find : am . M {
"first_name" : "Bob" ,
},
})
if err != nil {
return nil , err
}
Count the customers of the tenant acme let count = g . sys . db . count (
Count :: new ( "crm::acme" , "crm" , "customers" )
. find ( json ! ({
"first_name" : "Bob" ,
})),
) ? ;
Count the customers of the tenant acme var count = g . sys . db . count ( new Count ( "crm::acme" , "crm" , "customers" )
. find ( Map . of (
"first_name" , "Bob"
)));
Count the customers of the tenant acme val count = g . sys . db . count (
Count ( "crm::acme" , "crm" , "customers" )
. find ( mapOf (
"first_name" to "Bob" ,
)),
)
Without a schema
g.sys.db.gen.countGen takes the same arguments and calls the count 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.countGen(…)
Python
g.sys.db.gen.count_gen(…)
PHP
$g->sys->db->gen->countGen(…)
C#, Go
g.Sys.Db.Gen.CountGen(…)
Rust
g.sys.db.count_gen(Count::new(…))
Java, Kotlin
g.sys.db.gen.countGen(…)