Skip to content

Commit

Permalink
feat(db-ql): mark serverDate regexp as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Oct 15, 2021
1 parent 9cfb23d commit be9eb27
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
18 changes: 13 additions & 5 deletions packages/database-ql/src/regexp/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { SYMBOL_REGEXP } from '../helper/symbol'

/**
* @deprecated This method was deprecated, use js native `RegExp` instead
*/
export class RegExp {
$regex: string;
$options: string;
constructor({ regexp, options }: { regexp: string, options: string}) {
$regex: string
$options: string
constructor({ regexp, options }: { regexp: string, options: string }) {
if (!regexp) {
throw new TypeError('regexp must be a string')
}
this.$regex = regexp
this.$options = options ?? ''
this.$options = options || ''
}

parse() {
Expand All @@ -23,6 +26,11 @@ export class RegExp {
}
}

export function RegExpConstructor(param: { regexp: string, options: string}) {
/**
* @deprecated This method was deprecated, use js native `RegExp` instead
* @param param
* @returns
*/
export function RegExpConstructor(param: { regexp: string, options: string }) {
return new RegExp(param)
}
31 changes: 18 additions & 13 deletions packages/database-ql/src/serverDate/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
import { SYMBOL_SERVER_DATE } from '../helper/symbol'

export class ServerDate {
readonly offset: number;
readonly offset: number

constructor({ offset = 0 } = {}) {
this.offset = offset
}
constructor({ offset = 0 } = {}) {
this.offset = offset
}

get _internalType() {
return SYMBOL_SERVER_DATE
}
get _internalType() {
return SYMBOL_SERVER_DATE
}

parse() {
return {
$date: {
offset: this.offset
}
parse() {
return {
$date: {
offset: this.offset
}
}
}
}

export function ServerDateConstructor(opt?: { offset: number}) {
/**
* @deprecated This method is deprecated, not implemented in server side
* @param opt
* @returns
*/
export function ServerDateConstructor(opt?: { offset: number }) {
return new ServerDate(opt)
}

0 comments on commit be9eb27

Please sign in to comment.