org.neo4j.kernel.impl.proc.Procedures.callFunction()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中org.neo4j.kernel.impl.proc.Procedures.callFunction()方法的一些代码示例,展示了Procedures.callFunction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Procedures.callFunction()方法的具体详情如下:
包路径:org.neo4j.kernel.impl.proc.Procedures
类名称:Procedures
方法名:callFunction

Procedures.callFunction介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

private AnyValue callFunction( int id, AnyValue[] input, final AccessMode mode ) throws ProcedureException
{
  ktx.assertOpen();
  SecurityContext securityContext = ktx.securityContext().withMode( mode );
  try ( KernelTransaction.Revertable ignore = ktx.overrideWith( securityContext ) )
  {
    return procedures.callFunction( prepareContext( securityContext ), id, input );
  }
}

代码示例来源:origin: neo4j/neo4j

private AnyValue callFunction( QualifiedName name, AnyValue[] input, final AccessMode mode )
    throws ProcedureException
{
  ktx.assertOpen();
  SecurityContext securityContext = ktx.securityContext().withMode( mode );
  try ( KernelTransaction.Revertable ignore = ktx.overrideWith( securityContext ) )
  {
    return procedures.callFunction( prepareContext( securityContext ), name, input );
  }
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldCallRegisteredFunction() throws Throwable
{
  // Given
  procs.register( function );
  // When
  Object result = procs.callFunction( new BasicContext(), signature.name(), new AnyValue[] {numberValue( 1337 )} );
  // Then
  assertThat( result , equalTo( Values.of(1337) ) );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldNotAllowCallingNonExistingFunction() throws Throwable
{
  // Expect
  exception.expect( ProcedureException.class );
  exception.expectMessage( "There is no function with the name `org.myproc` registered for this " +
               "database instance. Please ensure you've spelled the " +
               "function name correctly and that the function is properly deployed." );
  // When
  procs.callFunction( new BasicContext(), signature.name(), new AnyValue[] {numberValue( 1337 )} );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldMakeContextAvailable() throws Throwable
{
  // Given
  Key<String> someKey = key("someKey", String.class);
  procs.register( new CallableUserFunction.BasicUserFunction( signature )
  {
    @Override
    public AnyValue apply( Context ctx, AnyValue[] input ) throws ProcedureException
    {
      return Values.stringValue( ctx.get( someKey ) );
    }
  } );
  BasicContext ctx = new BasicContext();
  ctx.put( someKey, "hello, world" );
  // When
  Object result = procs.callFunction( ctx, signature.name(), new AnyValue[0] );
  // Then
  assertThat( result, equalTo(Values.of("hello, world") ) );
}

代码示例来源:origin: org.neo4j/neo4j-kernel

private AnyValue callFunction( int id, AnyValue[] input, final AccessMode mode ) throws ProcedureException
{
  ktx.assertOpen();
  SecurityContext securityContext = ktx.securityContext().withMode( mode );
  try ( KernelTransaction.Revertable ignore = ktx.overrideWith( securityContext ) )
  {
    return procedures.callFunction( prepareContext( securityContext ), id, input );
  }
}

代码示例来源:origin: org.neo4j/neo4j-kernel

private AnyValue callFunction( QualifiedName name, AnyValue[] input, final AccessMode mode )
    throws ProcedureException
{
  ktx.assertOpen();
  SecurityContext securityContext = ktx.securityContext().withMode( mode );
  try ( KernelTransaction.Revertable ignore = ktx.overrideWith( securityContext ) )
  {
    return procedures.callFunction( prepareContext( securityContext ), name, input );
  }
}

相关文章