Skip to main content
Version: SDK-6.0.0

GetAllData

public BackndReturnObject GetAllData(string tableName);
public BackndReturnObject GetAllData(string tableName, int limit);
public BackndReturnObject GetAllData(string tableName, int limit, string firstKey);
public BackndReturnObject GetAllData(string tableName, int limit, string firstKey, TableSortOrder tableSortOrder);
public BackndReturnObject GetAllData(string tableName, string[] select);
public BackndReturnObject GetAllData(string tableName, string[] select, int limit);
public BackndReturnObject GetAllData(string tableName, string[] select, int limit, string firstKey);
public BackndReturnObject GetAllData(string tableName, string[] select, int limit, string firstKey, TableSortOrder tableSortOrder);

Parameters

ValueTypeDescriptionDefault
tableNamestringName of table to look up-
limitint(Optional) Number of game information rows to load. Minimum 1, maximum 100.10
selectstring[](Optional) Columns to include among existing columns in the rowIncludes all columns
firstKeystring(Optional) Starting point of data lookupData that was inserted last
sortOrderTableSortOrder(Optional) TableSortOrder.DESC(descending order) or TableSortOrder.ASC(ascending order)TableSortOrder.DESC(descending order)

Description

Among the values saved in the table, all values equal to the number of limits are loaded.

  • The data can be looked up regardless of schema definition status.
  • Both public and private data can be looked up.
  • In the case of a private table, you can look up only your own data.
  • The throughput of the data is the same regardless of whether the select clause is used.

Example

Synchronous

 BackndReturnObject bro = null;

// Load up to 10 rows from tableName
bro = Backnd.PlayerTable.GetAllData(tableName);
// When loading fails
if(bro.IsSuccess() == false)
{
Debug.Log("An issue occurred while reading data : " + bro.ToString());
}
// When loading is successful but data does not exist
if(bro.IsSuccess() && bro.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
}
// When more than one piece of data is loaded
if(bro.FlattenRows().Count > 0)
{
string inDate = bro.FlattenRows()[0]["inDate"].ToString();
int level = int.Parse(bro.FlattenRows()[0]["level"].ToString());
}
// Load up to one row from tableName
bro = Backnd.PlayerTable.GetAllData(tableName, 1);

// After the 'load up to one row' above is called, check if there are older pieces of data below to load additionally
if(bro.HasFirstKey() == false)
{
Debug.Log("The data to be loaded does not exist");
}

// If there is more data after the 'load up to one row' above is called, load the subsequent data
// (Data will be loaded from latest to oldest.)
bro = Backnd.PlayerTable.GetAllData(tableName, 1, bro.FirstKeystring());

// If there is more data after the 'load up to one row' above is called, load the subsequent data in descending order
// (Data will be loaded from latest to oldest.)
bro = Backnd.PlayerTable.GetAllData(tableName, 1, bro.FirstKeystring(), TableSortOrder.DESC);


// Only show columns included in selectList when loading data.
string[] selectList = new string[] { "intData", "doubleData" };

// Load up to 10 rows from tableName (Columns aside from those displayed in selectList will not be displayed.)
bro = Backnd.PlayerTable.GetAllData(tableName, selectList);

// Load one row from tableName (Columns aside from those displayed in selectList will not be displayed.)
bro = Backnd.PlayerTable.GetAllData(tableName, selectList, 1);

// If there is more data after the 'load up to one row' above is called, load the subsequent data
// (Data will be loaded from latest to oldest.)
// (Columns aside from those displayed in selectList will not be displayed.)
bro = Backnd.PlayerTable.GetAllData(tableName, selectList, 1, bro.FirstKeystring());

// If there is more data after the 'load up to one row' above is called, load the subsequent data in descending order
// (Data will be loaded from latest to oldest.)
// (Columns aside from those displayed in selectList will not be displayed.)
bro = Backnd.PlayerTable.GetAllData(tableName, selectList, 1, bro.FirstKeystring(), TableSortOrder.DESC);

Asynchronous


string[] selectList = new string[] { "intData", "doubleData" };

Backnd.PlayerTable.GetAllData(tableName, callback =>
{
if(callback.IsSuccess() == false)
{
Debug.Log("An issue occurred while reading data : " + callback.ToString());
}
// When loading is successful but data does not exist
if(callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
}
// When more than one piece of data is loaded
if(callback.FlattenRows().Count > 0)
{
string inDate = callback.FlattenRows()[0]["inDate"].ToString();
int level = int.Parse(callback.FlattenRows()[0]["level"].ToString());
}
});

Backnd.PlayerTable.GetAllData(tableName, 1, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
return;
}

if(callback.HasFirstKey() == false)
{
Debug.Log("The data to be read next does not exist");
return;
}
Backnd.PlayerTable.GetAllData(tableName, 1, callback.FirstKeystring(), callback2 =>
{
// Handled with callback2
});

Backnd.PlayerTable.GetAllData(tableName, 1, callback.FirstKeystring(), TableSortOrder.DESC, callback2 =>
{
// Handled with callback2
});
});


Backnd.PlayerTable.GetAllData(tableName, selectList, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
}
});

Backnd.PlayerTable.GetAllData(tableName, selectList, 1, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
return;
}
if(callback.HasFirstKey() == false)
{
Debug.Log("The data to be read next does not exist");
return;
}

Backnd.PlayerTable.GetAllData(tableName, selectList, 1, callback.FirstKeystring(), callback2 =>
{
// Handled with callback2
});
Backnd.PlayerTable.GetAllData(tableName, selectList, 1, callback.FirstKeystring(), TableSortOrder.DESC, callback2 =>
{
// Handled with callback2
});
});

ReturnCase

Success cases

When the lookup is successful
statusCode : 200
message : Success
returnValue : refer to GetReturnValuetoJSON

When the lookup succeeds but there is no row with the relevant inDate
statusCode : 200
message : Success
returnValue : {"serverTime":"2023-10-29T13:46:51.305Z","rows":[],"ConsumedCapacity":{"Read":{"CapacityUnits":0.5}}}

Error cases

When Get is attempted on a non-existent table
statusCode : 404
errorCode : NotFoundException
message : {tableName} table not found, {tableName} table cannot be found

When an attempt is made to load to an inactive tableName
statusCode : 412
errorCode : PreconditionFailed
message : inactiveTable prerequisites are not met

GetReturnValuetoJSON (Values within rows all differ depending on the data.)

{
"serverTime": "2023-10-29T13:09:53.832Z",
"rows": [
{
"stringData": {
"S": "57J5EO3CJOGE"
},
"floatData": {
"N": "0.17887"
},
"dateTimeData": {
"S": "2023-10-29 13:09:53.401"
},
"boolData": {
"BOOL": true
},
"doubleData": {
"N": "0.139331"
},
"inDate": {
"S": "2023-10-29T13:09:53.543Z"
},
"updatedAt": {
"S": "2023-10-29T13:09:53.545Z"
},
"dicData": {
"M": {
"key1": {
"S": "JQZB3TY7LUNE"
},
"key2": {
"S": "QZOUGY1PVIR6"
},
"key3": {
"S": "EBCWMSVZKKOM"
}
}
},
"owner_inDate": {
"S": "2022-07-18T07:42:46.490Z"
},
"listData": {
"L": [
{
"S": "WJOLDW7Q1TXW"
},
{
"S": "15XFDY0PSJTF"
},
{
"S": "SWTBY0LTRBGB"
}
]
},
"intData": {
"N": "108684"
}
}
],
// Time to load next after loading has expired
"firstKey": {
"inDate": {
"S": "2023-10-29T13:09:53.543Z"
}
},
"ConsumedCapacity": {
"Read": {
"CapacityUnits": 0.5,
"GlobalSecondaryIndexes": {
"partition-inDate-index": {
"CapacityUnits": 0.5
}
}
}
}
}

Sample Code

public class GameDataItem
{
public string nickName = Backnd.UserNickName;
public string ownerIndate = Backnd.PlayerInDate;
public string inDate;
public int hp;
public int mp;
public float atk;
public long money;
public Dictionary<string, string> equip = new Dictionary<string, string>();
public List<string> items = new List<string>();
public DateTime lastUpdate;

public GameDataItem()
{
}

public GameDataItem(BACKND.LitJson.JsonData json)
{
hp = int.Parse(json["hp"].ToString());
mp = int.Parse(json["mp"].ToString());
atk = float.Parse(json["atk"].ToString());
money = long.Parse(json["money"].ToString());

foreach(var column in json["equip"].Keys)
{
equip.Add(column, json["equip"][column].ToString());
}

for(int i = 0; i < json["items"].Count; i++)
{
items.Add(json["items"][i].ToString());
}
inDate = json["inDate"].ToString();
lastUpdate = DateTime.Parse(json["lastUpdate"].ToString());
}

public Param ToParam()
{
Param param = new Param();

param.Add("nickName", nickName);
param.Add("hp", hp);
param.Add("mp", mp);
param.Add("atk", atk);
param.Add("money", money);
param.Add("equip", equip);
param.Add("items", items);
param.Add("lastUpdate", DateTime.UtcNow);

return param;
}
public override string ToString()
{
string equipString = "equip\n";
foreach(var dic in equip)
{
equipString += $"-{dic.Key} : {dic.Value}\n";
}

string itemString = "items : ";
for(int i = 0; i < items.Count; i++)
{
itemString += $"{items[i]}, ";
}

return $"hp : {hp}\n" +
$"mp : {mp}\n" +
$"atk : {atk}\n" +
$"money : {money}\n" +
$"lastUpdate : {lastUpdate}\n" +
equipString + "\n" + itemString + "\n";
}
}
public void GetInDate()
{
var bro = Backnd.PlayerTable.GetAllData("PlayerInfo");

if(!bro.IsSuccess())
{
Debug.LogError(bro.ToString());
return;
}

BACKND.LitJson.JsonData gameDataListJson = bro.FlattenRows();

if(gameDataListJson.Count <= 0)
{
Debug.Log("The data does not exist");
return;
}

GameDataItem gameDataItem = new GameDataItem(gameDataListJson[0]);
Debug.Log(gameDataItem.ToString());
}