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

@dao3fun/pg-dbs

v1.0.1

Published

支持在Pro岛写SQL语法,类似与旧岛数据库的SQL操作,保持语法一致性。

Downloads

127

Readme

点鸭数据表----神奇代码岛Pro版

支持在Pro岛写SQL语法,类似与旧岛数据库的SQL操作,保持语法一致性。

如何创建表

可视化数据库管理:点鸭数据表后台管理

1.登入网站,创建数据表。

2.生成神岛Key,并填入代码中。

3.支持可视化修改数据表内容。

简单的语法操作:

  • 查询祖籍四川的同学的所有信息。
import PGdb, { PGdbFailResult } from "@dao3fun/pg-dbs";

// 创建数据库连接实例
const dbs = new PGdb("9D7194D9D5A4F188200417EA283132F0");

/**
 * 定义数据接口,用于描述数据库查询结果的结构
 * 包含了用户信息相关的字段,如创建时间、更新时间、祖籍、姓名等
 */
interface Data {
    createdAt: number;
    updatedAt: Date;
    祖籍: string;
    姓名: string;
    性别: string;
    小组: string;
    选修课程: string;
    平均分: number;
    授课教师: string;
}

// 执行SQL查询
dbs.sql<Data>`SELECT * FROM 9caf494c19dacfd4a6762d11e92db090 WHERE 祖籍="四川"`
    .then(value => {
        // 成功时,将查询结果转换为JSON字符串并打印
        console.log(JSON.stringify(value));
    }).catch((e: PGdbFailResult) => {
        // 失败时,打印错误代码
        console.error("Error:", JSON.stringify(e));
    })

返回:

{
	"code": 200,
	"msg": "查询数据成功",
	"logid": "cc802f836ac8f8ebb9fec2f2cbc0cdc4",
	"operatAt": "2024-11-05 13:42:03",
	"count": 2,
	"fields": [{
		"createdAt": 1,
		"updatedAt": "2024-11-04 13:42:03",
		"祖籍": "四川",
		"姓名": "贺靓晴",
		"性别": "男",
		"小组": "第一组",
		"选修课程": "英语",
		"平均分": 68,
		"授课教师": "Arleen"
	}, {
		"createdAt": 6,
		"updatedAt": "2024-11-03 13:42:03",
		"祖籍": "四川",
		"姓名": "云韶",
		"性别": "女",
		"小组": "第二组",
		"选修课程": "日语",
		"平均分": 85,
		"授课教师": "Perfect"
	}]
}

复杂的语法操作:

  • 查询第二组英语总分第一组英语总分高/低多少分,并给出第一组的最高分第二组的最低分 。#
// 创建数据库连接实例
const dbs = new PGdb("9D7194D9D5A4F188200417EA283132F0");

/**
 * 定义数据接口,用于描述数据库查询结果的结构
 * 包含了用户信息相关的字段,如创建时间、更新时间、祖籍、姓名等
 */
interface Data {
    createdAt: number;
    updatedAt: Date;
    祖籍: string;
    姓名: string;
    性别: string;
    小组: string;
    选修课程: string;
    平均分: number;
    授课教师: string;
}
// 数据表ID
const dbID = "9caf494c19dacfd4a6762d11e92db090";
//选修课程
const electiveCourses = "英语";

// 执行SQL查询
dbs.sql<Data>`SELECT 
    SUM(s2 - s1), 
    MAX(s1), 
    MIN(s2) 
FROM 
    (
    SELECT 
        平均分 AS s1 
    FROM 
        ${dbID} 
    WHERE 
        小组 ="第一组" 
        AND 选修课程 = ${electiveCourses}
    ) AS t1, 
    (
    SELECT 
        平均分 AS s2 
    FROM 
        ${dbID} 
    WHERE 
        小组 ="第二组" 
        AND 选修课程 = ${electiveCourses}
    ) AS t2`
    .then(value => {
        // 成功时,将查询结果转换为JSON字符串并打印
        console.log(JSON.stringify(value));
    }).catch((e: PGdbFailResult) => {
        // 失败时,打印错误代码
        console.error("Error:", JSON.stringify(e));
    })

返回:

{
    "code": 200,
    "msg": "查询数据成功",
    "logid": "bbc70cf2bb0a6b3cc8d51b4aeb2e2187",
    "operatAt": "2024-11-05 13:42:03",
    "count": 1,
    "fields": [
        {
            "SUM(s2 - s1)": -105,
            "MAX(s1)": 92,
            "MIN(s2)": 48
        }
    ]
}