kenxudk/yii2-dynamodb 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kenxudk/yii2-dynamodb

最新稳定版本:1.0.1

Composer 安装命令:

composer require kenxudk/yii2-dynamodb

包简介

Logical query of aws dynamodb

README 文档

README

996.icu

yii2-dynamodb

A aws dynamodb insert, delete, update, select package (一个简单的aws dynamodb 链路操作封装类)

composer

composer require kenxudk/yii2-dynamodb

description

Because I used the YII2 framework, the log is yii, and the AWS package is placed under the vender. The configuration file for this class is in params.php. as follows:

因为我用的时YII2框架,所以日志用的是yii的,并且AWS包放在vender下面,这个类的配置文件在params.php里面,如下:

   'aws'=>[
        'region'=>'ap-southeast-1',
        'version'=>'',
        'key'=>"",
        'secret'=>"",
    ],

simple use

TABLE_NAME is the name of the table you are using, TABLE_INDEX is currently using the index name (说明TABLE_NAME是你使用表名,TABLE_INDEX当前使用的索引名称)

add

$result = Dynamodb::table(TABLE_NAME)->insert($data);

update

$expressValue = $updata = $expressName = [];
$i = 0;
foreach ($up_arr as $key => $value) {
    $f = '#f'.$i;
    $v = ':v'.$i;
    $expressName[$f] = $key;
    $updata[] = [$f,$v];
    $expressValue[$v] = $value;
    $i++;
}
 $result = KmDynamodb::table(TABLE_NAME)->expressValue($expressValue)->kWhere(['pk_id'=>$primary_key])->expressName($expressName)->update($updata);

select

Get multiples with the primary key (batchGetItem)

    $keys = [];
    foreach ($primary_keys as $primary_key) {
        $keys[] = ['kid' => $primary_key];
    }
    $feeds = Dynamodb::table(TABLE_NAME)->kWhere($keys)->order(true)->ones(); 

Get one with the primary key (getItem)

   Dynamodb::table(TABLE_NAME)->kWhere(['kid'=>$primary_key])->one();

query

 Dynamodb::table(TABLE_NAME,TABLE_INDEX)->kWhere('kid=:v')
 ->expressValue([':v'=>$primary_key])->limit(10,[])->query();    

delete

Dynamodb::table(TABLE_NAME)->kWhere(['kid'=>$primary_key])->delete();  

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-09