Skip to content

Use DataType.array in registerFunction #99

Answered by oguimbal
imatveev asked this question in Q&A
Discussion options

You must be logged in to vote

Hi !

I wondered when someone would need this 😀

'array' is a type that is a bit special.

I exposed the necessary methods in pg-mem@1.9.5 (which were there, but not exposed)... so you can do this like that:

db.public.registerFunction({
		name: 'contains',
		args: [db.public.getType(DataType.integer).asArray(), DataType.integer],
		returns: DataType.bool,
		implementation: (array: number[], value: number) => array.contains(value)
	});

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@imatveev
Comment options

@oguimbal
Comment options

Answer selected by oguimbal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants