In webOS, how to define more Kinds?

30 Views Asked by At

I need more Kinds in my webOS project. For example movie and music

I learned that the "from" in the query, uses the _kind property.
So I thought, I can use the _kind as "table" name.
But unfortunately the put process does not allow me to set the _kind to "movie" or anything similar.
Only the "my.db8.example:1" is allowed, which is my appId+":1"

putKind:

var appId = "my.db8.example";
var kindId = appId + ":1";

webOS.service.request("luna://com.palm.db", {
    method: "putKind",
    parameters: {
      id: kindId,
      owner: appId,          
      schema: {
        path: {
            type: "string"
        },
        genre: {
            type: "string"
        }                            
      },
      indexes: [
        {
          name: "index1",
          props: [{ name: "genre" }],
        },
      ],
    },
    onSuccess: function (res) {
      printLog("[putKind] onSuccess");
    },
    onFailure: function (res) {
      printLog("[putKind] onFailure");
    },
  }

put:

webOS.service.request("luna://com.palm.db", {
    method: "put",
    parameters: {
      objects: [
        {
          _kind: kindId,             
          path: path,
          genre: genre,
        },
      ],
    },
    onSuccess: function (res) {
      printLog("[put] onSuccess: " + path + ", " + year + ", " + genre);
    },
    onFailure: function (res) {
      printLog("[put] onFailure: " + path + ", " + year + ", " + genre);
      printLog("(" + res.errorCode + ") " + res.errorText);
      return;
    },
  };

Can someone tell me what is the way to differentiate/identify two/more kinds?

0

There are 0 best solutions below