Options
All
  • Public
  • Public/Protected
  • All
Menu

Module validate/rule

Index

Namespaces

Variables

Functions

Variables

RuleType

0.0.46 provide
RuleType: Root

Functions

Rule

0.0.46 provide
  • 为DTO对象添加规则的装饰器

    example

    装饰器属性

     class UserDTO {
       @Rule(RuleType.number().max(10))
       age: number;
     }
    
    example

    针对extends进行装饰

      class TO {}
    
      @Rule(TO)
      class UserDTO extends TO {
        @Rule(RuleType.number().max(10))
        age: number;
      }
    
    example

    属性类装饰

     class WorldDTO {
       @Rule(RuleType.number().max(20))
       age: number;
     }
    
     class UserDTO {
       @Rule(RuleType.number().max(10))
       age: number;
    
       @Rule(WorldDTO)
       world: WorldDTO;
     }
    
    @Rule(UserDTO)
    class EmployeeUserDto extends UserDto {
       @Rule(RuleType.string().required())
       post: string;
    }
    

    Parameters

    Returns (...args: any[]) => void

      • (...args: any[]): void
      • Parameters

        • Rest ...args: any[]

        Returns void