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

@ctsy/controller

v2.0.30

Published

```typescript // 基础控制器 // 提供 this._session,this._cookie,this.M,this.R基础操作 import {BaseController} from 'castle-controller' export default class cc extends BaseController{

Downloads

69

Readme

castle-server框架 控制器基础库

// 基础控制器
// 提供 this._session,this._cookie,this.M,this.R基础操作
import {BaseController} from 'castle-controller'
export default class cc extends BaseController{

}

import Relation from 'castle-relation';
import Model from 'castle-model';
export default class BaseController {
    _ctx: any;
    _config: any;
    _ModelName: string;
    __proto__: any;
    readonly _KeywordFields: Array<string>;
    readonly _KeywordTable: string;
    /**
     * search请求时的允许参与搜索的字段配置
     */
    readonly _WFields: string[];
    /**
     * 保存数据时的字段过滤
     */
    readonly _saveFields: any;
    readonly _searchFields: string[];
    readonly _WTable: string;
    protected readonly _pk: string;
    readonly _model: any;
    constructor(ctx: any);
    protected _checkPermission(): Promise<boolean>;
    /**
     * 发送下载文件,
     * @param path 文件路径
     * @param filename 文件名称
     */
    protected _send(path: string, filename: string): Promise<void>;
    /**
     * 发送下载文件
     * @param content 文件内容
     * @param filename 文件名称
     */
    protected _sendContent(content: any, filename: string): void;
    protected _cookie(name: string, value?: string, options?: Object): any;
    protected _session(name: string, value?: any): Promise<any>;
    /**
     * Web服务中的发送数据
     * @param path
     */
    protected _sendFile(file: string, ext?: string, config?: {}): Promise<void>;
    readonly _files: {
        [index: string]: any;
    };
    protected M(TableName?: string): Model;
    trans: any;
    /**
     * 开启事务
     */
    protected startTrans(): Promise<any>;
    /**
     * 提交数据库事务
     */
    protected commit(): Promise<any>;
    /**
     * 撤销数据库事务
     */
    protected rollback(): Promise<any>;
    protected R(RelationName: string): Promise<Relation>;
    protected I(name: string, options?: Object | any): any;
}


// 支持CURD操作的控制器
//提供 get/save/add/adds/saveW/search/del/delW/replaceW方法
import {Controller} from "castle-controller"
export default class cc extends Controller{

}


import BaseController from './base_controller';
export default class Controller extends BaseController {
    /**
     * 查询请求
     * @param post
     */
    search(post: any): Promise<{
        L: any;
        T: number;
        P: any;
        N: any;
        R: {};
    }>;
    /**
     * 获取单个
     * @param post
     * @param ctx
     */
    get(post: any, ctx: any): Promise<any>;
    /**
     * 添加
     * @param post
     * @param ctx
     */
    add(post: any, ctx: any): Promise<any>;
    /**
     * 删除
     * @param post
     * @param ctx
     */
    del(post: any, ctx: any): Promise<any>;
    /**
     * 更新
     * @param post
     * @param ctx
     */
    save(post: any, ctx: any): Promise<any>;
    /**
     * 条件更新
     * @param post
     * @param ctx
     */
    saveW(post: any, ctx: any): Promise<any>;
    /**
     * 条件删除
     * @param post
     * @param ctx
     */
    delW(post: any, ctx: any): Promise<any>;
    /**
     * 批量添加
     * @param post
     * @param ctx
     */
    adds(post: any, ctx: any): Promise<any>;
    /**
     * 批量替换
     * @param post
     * @param ctx
     */
    replaceW(post: any, ctx: any): Promise<any>;
}

开始支持ejs渲染,

在模块或根路径下创建view目录,