npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

databaseserve

v1.0.7

Published

indexdb普通操作的类 自己使用以防忘记对于indexdb的操作 懒得看文档

Downloads

11

Readme

个人使用的indexDB的基本操作的类

邮箱 [email protected] 这是本人的邮箱 又不懂的 可以发邮箱给我(This is my email address and do not understand can send email to me)

let tableList = [
      {
        tableName:'student',
        option:{
          keyPath:'id'
        }
      }
    ]

    let indexList = [
      {
        name:'id',
        keyPath:'id'
      },
      {
        name:'name',
        keyPath:'name'
      },
      {
        name:'age',
        keyPath:['page','nianling']
      }
    ]


    let dataBaseServe = new DataBaseServe('test',1,tableList,indexList,()=>{
      // 增加
      dataBaseServe.add('test','student',[{id:1,name:'测试1',age:11},{id:2,name:'测试2',age:22},{id:3,name:'测试3',age:33}])
      .then((list)=>{
        console.log('成功数组',list)
      })
      .catch((list,errStr)=>{
        console.log('失败数组',list)
        console.log('失败原因',errStr)
      })

      // 主键查询
      dataBaseServe.getKey('test','student',1)
        .then((obj)=>{
            console.log('查询的结果',obj);
        })
        .catch((str)=>{
          console.log('查询失败',str);
        })

      // 游标查询
      dataBaseServe.getCursor('test','student',(res)=>{
        console.log('查询的结果',res);
      }).then(list=>{
        console.log('所有',list)
      })

      // 索引查询
      dataBaseServe.getIndex('test','student','name')
      .then((list)=>{
        console.log('查询的结果',list);
      })
      .catch((str)=>{
        console.log('查询失败',str);
      })

      // 自定义操作
      dataBaseServe.getDivFun('test','student',(res)=>{
        console.log(res)
      })

      // 更新
      dataBaseServe.update('test','student',[{id:1,name:'测试111s',age:11},{id:3,name:'测试3336',age:111},{id:5,name:'测试555',age:555}])
      .then((list)=>{
        console.log('成功数组',list)
      })
      .catch((list,errStr)=>{
        console.log('==失败数组',list,'失败原因',errStr)
      })

      // 删除
      dataBaseServe.del('test','student',[])
      .then((list)=>{
        console.log('成功数组',list)
      })
      .catch((list,errStr)=>{
        console.log('==失败数组',list,'失败原因',errStr)
      })
    })

1.0.3 更新文件上传和下载


 let tableList = [
      {
        tableName:'fileTable',
        option:{
          keyPath:'id'
        }
      }
    ]

    let indexTable = [
      {
        name:'name',
        keyPath:['name','png','jpg'],
        option:{
          unique:true
        }
      }
    ]

    const dataBaseServe = new DataBaseServe('fileBase',1,tableList,indexTable,()=>{
      dataBaseServe.downloadFile('fileBase','fileTable',1);
    });
    
    this.$refs.fileRef.addEventListener("change",e=>{
      const file = e.target.files[0];

      dataBaseServe.uploadFile('fileBase','fileTable','id',2,'测试文件',file,'.png');
    })