Role Based Mapping Insert in Kong Database


I am trying to implement Authorization logic in Serverless Lua functions where I will be accessing kong database to get the custom rules defined for apis defined on Kong

Is there any API possible to add rules in Kong Database and then access in ServerLess function using kong.db ?