github.com/matrixorigin/matrixone@v0.7.0/pkg/sql/plan/function/builtin/multi/current_timestamp_test.go (about) 1 // Copyright 2021 - 2022 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package multi 16 17 import ( 18 "fmt" 19 "testing" 20 "time" 21 22 "github.com/matrixorigin/matrixone/pkg/container/types" 23 "github.com/matrixorigin/matrixone/pkg/container/vector" 24 "github.com/matrixorigin/matrixone/pkg/testutil" 25 "github.com/stretchr/testify/require" 26 ) 27 28 func TestCurrentTimestamp(t *testing.T) { 29 myProc := testutil.NewProc() 30 resultVector, err := CurrentTimestamp(nil, myProc) 31 require.NoError(t, err) 32 resultValues := vector.MustTCols[types.Timestamp](resultVector) 33 resultStr := resultValues[0].String2(time.Local, 6) 34 fmt.Println(resultStr) 35 36 inputVector0 := testutil.MakeScalarInt64(3, 4) 37 inputVectors := []*vector.Vector{inputVector0} 38 resultVector, err = CurrentTimestamp(inputVectors, myProc) 39 require.NoError(t, err) 40 resultValues = vector.MustTCols[types.Timestamp](resultVector) 41 resultStr = resultValues[0].String2(time.Local, resultVector.Typ.Precision) 42 fmt.Println(resultStr) 43 }