Skip to content

Commit

Permalink
Merge pull request #4 from kristiandupont/main
Browse files Browse the repository at this point in the history
Add toPostgres method
  • Loading branch information
martianboy authored Jan 29, 2024
2 parents 1d58f87 + da7efb1 commit d1a6c46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export class Range<T> {

containsPoint (point: T): boolean;
containsRange (range: Range<T>): boolean;

toPostgres (prepareValue: (value: any) => string): string;
}

export function parse(input: string): Range<string>;
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class Range {
(!range.hasUpperBound() || this.containsPoint(range.upper))
)
}

toPostgres (prepareValue) {
return serialize(this, prepareValue);
}
}

/**
Expand Down

0 comments on commit d1a6c46

Please sign in to comment.