@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
@ -0,0 +1,2 @@
|
|||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
|
||||||
|
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
@ -0,0 +1,7 @@
|
|||||||
|
0c28388c09ff373d391fe66d085dd39d
|
||||||
|
|
||||||
|
wx08c675f6ba5b2cdc
|
||||||
|
|
||||||
|
3317b29d14270cebb8f4e3521506f285
|
||||||
|
|
||||||
|
wx954296403ec15396
|
@ -0,0 +1,316 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Maven Start Up Batch script
|
||||||
|
#
|
||||||
|
# Required ENV vars:
|
||||||
|
# ------------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# M2_HOME - location of maven2's installed home dir
|
||||||
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
# e.g. to debug Maven itself, use
|
||||||
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||||
|
. /usr/local/etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/mavenrc ] ; then
|
||||||
|
. /etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$HOME/.mavenrc" ] ; then
|
||||||
|
. "$HOME/.mavenrc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OS specific support. $var _must_ be set to either true or false.
|
||||||
|
cygwin=false;
|
||||||
|
darwin=false;
|
||||||
|
mingw=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN*) cygwin=true ;;
|
||||||
|
MINGW*) mingw=true;;
|
||||||
|
Darwin*) darwin=true
|
||||||
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||||
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
|
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||||
|
else
|
||||||
|
export JAVA_HOME="/Library/Java/Home"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
if [ -r /etc/gentoo-release ] ; then
|
||||||
|
JAVA_HOME=`java-config --jre-home`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$M2_HOME" ] ; then
|
||||||
|
## resolve links - $0 may be a link to maven's home
|
||||||
|
PRG="$0"
|
||||||
|
|
||||||
|
# need this for relative symlinks
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG="`dirname "$PRG"`/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
saveddir=`pwd`
|
||||||
|
|
||||||
|
M2_HOME=`dirname "$PRG"`/..
|
||||||
|
|
||||||
|
# make it fully qualified
|
||||||
|
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||||
|
|
||||||
|
cd "$saveddir"
|
||||||
|
# echo Using m2 at $M2_HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $mingw ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
javaExecutable="`which javac`"
|
||||||
|
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||||
|
# readlink(1) is not available as standard on Solaris 10.
|
||||||
|
readLink=`which readlink`
|
||||||
|
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||||
|
if $darwin ; then
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||||
|
else
|
||||||
|
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||||
|
fi
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||||
|
JAVA_HOME="$javaHome"
|
||||||
|
export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVACMD" ] ; then
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||||
|
echo " We cannot execute $JAVACMD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
echo "Warning: JAVA_HOME environment variable is not set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||||
|
|
||||||
|
# traverses directory structure from process work directory to filesystem root
|
||||||
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
|
find_maven_basedir() {
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Path not specified to find_maven_basedir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir="$1"
|
||||||
|
wdir="$1"
|
||||||
|
while [ "$wdir" != '/' ] ; do
|
||||||
|
if [ -d "$wdir"/.mvn ] ; then
|
||||||
|
basedir=$wdir
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||||
|
if [ -d "${wdir}" ]; then
|
||||||
|
wdir=`cd "$wdir/.."; pwd`
|
||||||
|
fi
|
||||||
|
# end of workaround
|
||||||
|
done
|
||||||
|
echo "${basedir}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# concatenates all lines of a file
|
||||||
|
concat_lines() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
echo "$(tr -s '\n' ' ' < "$1")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||||
|
if [ -z "$BASE_DIR" ]; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
##########################################################################################
|
||||||
|
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||||
|
fi
|
||||||
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
else
|
||||||
|
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
fi
|
||||||
|
while IFS="=" read key value; do
|
||||||
|
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||||
|
esac
|
||||||
|
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Downloading from: $jarUrl"
|
||||||
|
fi
|
||||||
|
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||||
|
if $cygwin; then
|
||||||
|
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v wget > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found wget ... using wget"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
elif command -v curl > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found curl ... using curl"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
else
|
||||||
|
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Falling back to using Java to download"
|
||||||
|
fi
|
||||||
|
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||||
|
# For Cygwin, switch paths to Windows format before running javac
|
||||||
|
if $cygwin; then
|
||||||
|
javaClass=`cygpath --path --windows "$javaClass"`
|
||||||
|
fi
|
||||||
|
if [ -e "$javaClass" ]; then
|
||||||
|
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
# Compiling the Java class
|
||||||
|
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||||
|
fi
|
||||||
|
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
# Running the downloader
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Running MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
##########################################################################################
|
||||||
|
# End of extension
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo $MAVEN_PROJECTBASEDIR
|
||||||
|
fi
|
||||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||||
|
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||||
|
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
# work with both Windows and non-Windows executions.
|
||||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||||
|
export MAVEN_CMD_LINE_ARGS
|
||||||
|
|
||||||
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
$MAVEN_OPTS \
|
||||||
|
$MAVEN_DEBUG_OPTS \
|
||||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
|
"-Dmaven.home=${M2_HOME}" \
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
@ -0,0 +1,188 @@
|
|||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. You may obtain a copy of the License at
|
||||||
|
@REM
|
||||||
|
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@REM
|
||||||
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Maven Start Up Batch script
|
||||||
|
@REM
|
||||||
|
@REM Required ENV vars:
|
||||||
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM M2_HOME - location of maven2's installed home dir
|
||||||
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||||
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||||
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
@REM e.g. to debug Maven itself, use
|
||||||
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||||
|
@echo off
|
||||||
|
@REM set title of command window
|
||||||
|
title %0
|
||||||
|
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||||
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||||
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||||
|
|
||||||
|
@REM Execute a user defined script before this one
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||||
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||||
|
:skipRcPre
|
||||||
|
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
set ERROR_CODE=0
|
||||||
|
|
||||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME not found in your environment. >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
:OkJHome
|
||||||
|
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||||
|
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
@REM ==== END VALIDATION ====
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||||
|
@REM Fallback to current working directory if not found.
|
||||||
|
|
||||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||||
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||||
|
|
||||||
|
set EXEC_DIR=%CD%
|
||||||
|
set WDIR=%EXEC_DIR%
|
||||||
|
:findBaseDir
|
||||||
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||||
|
cd ..
|
||||||
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||||
|
set WDIR=%CD%
|
||||||
|
goto findBaseDir
|
||||||
|
|
||||||
|
:baseDirFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
goto endDetectBaseDir
|
||||||
|
|
||||||
|
:baseDirNotFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
|
||||||
|
:endDetectBaseDir
|
||||||
|
|
||||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||||
|
|
||||||
|
@setlocal EnableExtensions EnableDelayedExpansion
|
||||||
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||||
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||||
|
|
||||||
|
:endReadAdditionalConfig
|
||||||
|
|
||||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
|
||||||
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
if exist %WRAPPER_JAR% (
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Found %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if not "%MVNW_REPOURL%" == "" (
|
||||||
|
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
)
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||||
|
echo Downloading from: %DOWNLOAD_URL%
|
||||||
|
)
|
||||||
|
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$webclient = new-object System.Net.WebClient;"^
|
||||||
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||||
|
"}"^
|
||||||
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||||
|
"}"
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Finished downloading %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@REM End of extension
|
||||||
|
|
||||||
|
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
@REM work with both Windows and non-Windows executions.
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
%MAVEN_JAVA_EXE% ^
|
||||||
|
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||||
|
%MAVEN_OPTS% ^
|
||||||
|
%MAVEN_DEBUG_OPTS% ^
|
||||||
|
-classpath %WRAPPER_JAR% ^
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||||
|
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||||
|
|
||||||
|
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||||
|
:skipRcPost
|
||||||
|
|
||||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||||
|
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||||
|
|
||||||
|
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||||
|
|
||||||
|
cmd /C exit /B %ERROR_CODE%
|
@ -0,0 +1,150 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.7.4</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.example</groupId>
|
||||||
|
<artifactId>demo</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>demo</name>
|
||||||
|
<description>Demo project for Spring Boot</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>5.1.47</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- http请求工具包依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpclient</artifactId>
|
||||||
|
<version>4.5.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcprov-jdk16</artifactId>
|
||||||
|
<version>1.46</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--base64加密解密-->
|
||||||
|
<!--shiro依赖和缓存-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-core</artifactId>
|
||||||
|
<version>1.4.0</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<!-- 表格导出-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>3.17</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>3.17</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.xmlunit</groupId>
|
||||||
|
<artifactId>xmlunit-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- fastjson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.47</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--简化代码的工具包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<!--mybatis-plus的springboot支持-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.4.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!--springdoc 官方Starter-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-ui</artifactId>
|
||||||
|
<version>1.6.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-common</artifactId>
|
||||||
|
<version>1.6.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
<version>2.1.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>2.1.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.7.22</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
|
||||||
|
@ComponentScan(basePackages = {"com.example.demo.controller", "com.example.demo.config", "com.example.demo.service.impl","com.example.demo.mapper"})
|
||||||
|
@MapperScan("com.example.demo.mapper")
|
||||||
|
|
||||||
|
public class DemoApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(DemoApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.example.demo.controller;
|
||||||
|
|
||||||
|
import com.example.demo.common.util.FormatResponseUtil;
|
||||||
|
import com.example.demo.common.util.ResponseResult;
|
||||||
|
import com.example.demo.domain.Dragon;
|
||||||
|
import com.example.demo.service.impl.DragonServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/dragon")
|
||||||
|
public class DragonController {
|
||||||
|
@Autowired
|
||||||
|
DragonServiceImpl dragonService;
|
||||||
|
|
||||||
|
@GetMapping("/dragonList")
|
||||||
|
public ResponseResult queryAll() {
|
||||||
|
return FormatResponseUtil.formatResponse(dragonService.queryAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/addDragon")
|
||||||
|
public ResponseResult addDragon(@RequestBody Dragon dragon) {
|
||||||
|
//System.out.println("1111111111");
|
||||||
|
return FormatResponseUtil.formatResponse(dragonService.save(dragon));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")//这里执行的是物理删除
|
||||||
|
public ResponseResult delTDragonById(Integer id) {
|
||||||
|
return FormatResponseUtil.formatResponse(dragonService.delDragonById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/one")
|
||||||
|
public ResponseResult queryById(int id) {
|
||||||
|
return FormatResponseUtil.formatResponse(dragonService.queryDragonById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/dragonInfo")
|
||||||
|
public ResponseResult updateArea(@RequestBody Dragon dragon) {
|
||||||
|
return FormatResponseUtil.formatResponse(dragonService.updateById(dragon));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
package com.example.demo.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
public class Dragon {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static final String CREATE_TIME = "createTime";
|
||||||
|
public static final String MODIFIED_TIME = "lastEditTime";
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
/*
|
||||||
|
* 任务内容
|
||||||
|
* */
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间戳
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private String deadtime;
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeadtime() {
|
||||||
|
return deadtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeadtime(String deadtime) {
|
||||||
|
this.deadtime = deadtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后修改时间戳
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
|
private LocalDateTime lastTime;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProperty() {
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperty(String property) {
|
||||||
|
this.property = property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(LocalDateTime createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getLastEditTime() {
|
||||||
|
return lastTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastEditTime(LocalDateTime lastEditTime) {
|
||||||
|
this.lastTime = lastEditTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Dragon{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name=" + name +
|
||||||
|
", priority=" + property +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
", lastEditTime=" + lastTime +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.example.demo.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.demo.domain.Dragon;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 和数据库的连接层
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface DragonMapper extends BaseMapper<Dragon> {
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.example.demo.mapper.DragonMapper">
|
||||||
|
</mapper>
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.example.demo.service;
|
||||||
|
|
||||||
|
import com.example.demo.domain.Dragon;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 面向数据库的接口
|
||||||
|
*/
|
||||||
|
public interface IDragonService {
|
||||||
|
/**
|
||||||
|
* 查询所有Area
|
||||||
|
*/
|
||||||
|
List<Dragon> queryAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过Id查询Dragon
|
||||||
|
*/
|
||||||
|
Dragon queryDragonById(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过Id删除Dragon
|
||||||
|
*/
|
||||||
|
boolean delDragonById(int id);
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.example.demo.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.example.demo.domain.Dragon;
|
||||||
|
import com.example.demo.mapper.DragonMapper;
|
||||||
|
import com.example.demo.service.IDragonService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DragonServiceImpl extends ServiceImpl<DragonMapper, Dragon> implements IDragonService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DragonMapper dragonMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Dragon> queryAll() {
|
||||||
|
LambdaQueryWrapper<Dragon> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.orderByAsc(Dragon::getId);
|
||||||
|
List<Dragon> dragonList = dragonMapper.selectList(wrapper);
|
||||||
|
return dragonList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dragon queryDragonById(int id) {
|
||||||
|
Dragon dragon = dragonMapper.selectById(id);
|
||||||
|
return dragon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean delDragonById(int id) {
|
||||||
|
boolean ans;
|
||||||
|
int i = dragonMapper.deleteById(id);
|
||||||
|
return ans = i > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
server:
|
||||||
|
port: 81
|
||||||
|
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: wxlogin
|
||||||
|
|
||||||
|
datasource:
|
||||||
|
|
||||||
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/wxlogin?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true&useSSL=false
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
thymeleaf:
|
||||||
|
cache: false
|
@ -0,0 +1,233 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>Dashboard Template for Bootstrap</title>
|
||||||
|
<!-- Bootstrap core CSS -->
|
||||||
|
<link href="asserts/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Custom styles for this template -->
|
||||||
|
<link href="asserts/css/dashboard.css" rel="stylesheet">
|
||||||
|
<style type="text/css">
|
||||||
|
/* Chart.js */
|
||||||
|
|
||||||
|
@-webkit-keyframes chartjs-render-animation {
|
||||||
|
from {
|
||||||
|
opacity: 0.99
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes chartjs-render-animation {
|
||||||
|
from {
|
||||||
|
opacity: 0.99
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.chartjs-render-monitor {
|
||||||
|
-webkit-animation: chartjs-render-animation 0.001s;
|
||||||
|
animation: chartjs-render-animation 0.001s;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
|
||||||
|
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">Company name</a>
|
||||||
|
<input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
|
||||||
|
<ul class="navbar-nav px-3">
|
||||||
|
<li class="nav-item text-nowrap">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">Sign out</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
|
||||||
|
<div class="sidebar-sticky">
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home">
|
||||||
|
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
|
||||||
|
<polyline points="9 22 9 12 15 12 15 22"></polyline>
|
||||||
|
</svg>
|
||||||
|
Dashboard <span class="sr-only">(current)</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file">
|
||||||
|
<path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
|
||||||
|
<polyline points="13 2 13 9 20 9"></polyline>
|
||||||
|
</svg>
|
||||||
|
Orders
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-cart">
|
||||||
|
<circle cx="9" cy="21" r="1"></circle>
|
||||||
|
<circle cx="20" cy="21" r="1"></circle>
|
||||||
|
<path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path>
|
||||||
|
</svg>
|
||||||
|
Products
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-users">
|
||||||
|
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
|
||||||
|
<circle cx="9" cy="7" r="4"></circle>
|
||||||
|
<path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
|
||||||
|
<path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
|
||||||
|
</svg>
|
||||||
|
Customers
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart-2">
|
||||||
|
<line x1="18" y1="20" x2="18" y2="10"></line>
|
||||||
|
<line x1="12" y1="20" x2="12" y2="4"></line>
|
||||||
|
<line x1="6" y1="20" x2="6" y2="14"></line>
|
||||||
|
</svg>
|
||||||
|
Reports
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-layers">
|
||||||
|
<polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
|
||||||
|
<polyline points="2 17 12 22 22 17"></polyline>
|
||||||
|
<polyline points="2 12 12 17 22 12"></polyline>
|
||||||
|
</svg>
|
||||||
|
Integrations
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
|
||||||
|
<span>Saved reports</span>
|
||||||
|
<a class="d-flex align-items-center text-muted" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg>
|
||||||
|
</a>
|
||||||
|
</h6>
|
||||||
|
<ul class="nav flex-column mb-2">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
|
||||||
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
||||||
|
<polyline points="14 2 14 8 20 8"></polyline>
|
||||||
|
<line x1="16" y1="13" x2="8" y2="13"></line>
|
||||||
|
<line x1="16" y1="17" x2="8" y2="17"></line>
|
||||||
|
<polyline points="10 9 9 9 8 9"></polyline>
|
||||||
|
</svg>
|
||||||
|
Current month
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
|
||||||
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
||||||
|
<polyline points="14 2 14 8 20 8"></polyline>
|
||||||
|
<line x1="16" y1="13" x2="8" y2="13"></line>
|
||||||
|
<line x1="16" y1="17" x2="8" y2="17"></line>
|
||||||
|
<polyline points="10 9 9 9 8 9"></polyline>
|
||||||
|
</svg>
|
||||||
|
Last quarter
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
|
||||||
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
||||||
|
<polyline points="14 2 14 8 20 8"></polyline>
|
||||||
|
<line x1="16" y1="13" x2="8" y2="13"></line>
|
||||||
|
<line x1="16" y1="17" x2="8" y2="17"></line>
|
||||||
|
<polyline points="10 9 9 9 8 9"></polyline>
|
||||||
|
</svg>
|
||||||
|
Social engagement
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
|
||||||
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
||||||
|
<polyline points="14 2 14 8 20 8"></polyline>
|
||||||
|
<line x1="16" y1="13" x2="8" y2="13"></line>
|
||||||
|
<line x1="16" y1="17" x2="8" y2="17"></line>
|
||||||
|
<polyline points="10 9 9 9 8 9"></polyline>
|
||||||
|
</svg>
|
||||||
|
Year-end sale
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
|
||||||
|
<h1>404</h1>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Bootstrap core JavaScript
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js" ></script>
|
||||||
|
<script type="text/javascript" src="asserts/js/popper.min.js" ></script>
|
||||||
|
<script type="text/javascript" src="asserts/js/bootstrap.min.js" ></script>
|
||||||
|
|
||||||
|
<!-- Icons -->
|
||||||
|
<script type="text/javascript" src="asserts/js/feather.min.js" ></script>
|
||||||
|
<script>
|
||||||
|
feather.replace()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Graphs -->
|
||||||
|
<script type="text/javascript" src="asserts/js/Chart.min.js" ></script>
|
||||||
|
<script>
|
||||||
|
var ctx = document.getElementById("myChart");
|
||||||
|
var myChart = new Chart(ctx, {
|
||||||
|
type: 'line',
|
||||||
|
data: {
|
||||||
|
labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
||||||
|
datasets: [{
|
||||||
|
data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
|
||||||
|
lineTension: 0,
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
borderColor: '#007bff',
|
||||||
|
borderWidth: 4,
|
||||||
|
pointBackgroundColor: '#007bff'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
scales: {
|
||||||
|
yAxes: [{
|
||||||
|
ticks: {
|
||||||
|
beginAtZero: false
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
display: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table border="0" style="margin-top:4px; margin-left: 18px">
|
||||||
|
<tr>
|
||||||
|
<td><a href="#" class="easyui-linkbutton" onclick="downloadfile();">数据导出</a></td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<script>
|
||||||
|
function downloadfile() {
|
||||||
|
window.location.href = "/exceldownload";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class DemoApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
{"containers":[],"config":{}}
|
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
"pages/index/index",
|
||||||
|
"pages/menu/menu",
|
||||||
|
"pages/my/my",
|
||||||
|
"pages/bd/bd",
|
||||||
|
"pages/uploadfile/uploadfile",
|
||||||
|
"pages/list/list",
|
||||||
|
"pages/operation/operation",
|
||||||
|
"pages/list1/list1",
|
||||||
|
"pages/operation1/operation1",
|
||||||
|
"pages/mmm/mmm",
|
||||||
|
"pages/submit/submit",
|
||||||
|
"pages/dragon/dragon"
|
||||||
|
],
|
||||||
|
"window": {
|
||||||
|
"backgroundTextStyle": "light",
|
||||||
|
"navigationBarBackgroundColor": "#fff",
|
||||||
|
"navigationBarTitleText": "班级通",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
},
|
||||||
|
"tabBar": {
|
||||||
|
"selectedColor": "#33a3dc",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"pagePath": "pages/index/index",
|
||||||
|
"text": "首页",
|
||||||
|
"iconPath": "/static/index/index.png",
|
||||||
|
"selectedIconPath": "/static/index/index_active.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/menu/menu",
|
||||||
|
"text": "菜单",
|
||||||
|
"iconPath": "/static/menu/menu.png",
|
||||||
|
"selectedIconPath": "/static/menu/menu_active.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/my/my",
|
||||||
|
"text": "我的",
|
||||||
|
"iconPath": "/static/my/my.png",
|
||||||
|
"selectedIconPath": "/static/my/my_active.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"style": "v2",
|
||||||
|
"sitemapLocation": "sitemap.json"
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
// app.ts
|
||||||
|
App<IAppOption>({
|
||||||
|
globalData: {
|
||||||
|
|
||||||
|
},
|
||||||
|
onLaunch() {
|
||||||
|
// 展示本地存储能力
|
||||||
|
// const logs = wx.getStorageSync('logs') || []
|
||||||
|
// logs.unshift(Date.now())
|
||||||
|
// wx.setStorageSync('logs', logs)
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
// wx.login({
|
||||||
|
// success: res => {
|
||||||
|
// console.log(res.code)
|
||||||
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
})
|
@ -0,0 +1,6 @@
|
|||||||
|
/**app.wxss**/
|
||||||
|
page {
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: scroll;
|
||||||
|
background: rgb(243, 243, 243);
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||||
|
"rules": [{
|
||||||
|
"action": "allow",
|
||||||
|
"page": "*"
|
||||||
|
}]
|
||||||
|
}
|
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,19 @@
|
|||||||
|
export const formatTime = (date: Date) => {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = date.getMonth() + 1
|
||||||
|
const day = date.getDate()
|
||||||
|
// const hour = date.getHours()
|
||||||
|
// const minute = date.getMinutes()
|
||||||
|
// const second = date.getSeconds()
|
||||||
|
|
||||||
|
return (
|
||||||
|
[year, month, day].map(formatNumber).join('-')
|
||||||
|
// + ' ' +
|
||||||
|
// [hour, minute, second].map(formatNumber).join(':')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatNumber = (n: number) => {
|
||||||
|
const s = n.toString()
|
||||||
|
return s[1] ? s : '0' + s
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "miniprogram-ts-less-quickstart",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"scripts": {
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "",
|
||||||
|
"dependencies": {
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"miniprogram-api-typings": "^2.8.3-1"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"module": "CommonJS",
|
||||||
|
"target": "ES2020",
|
||||||
|
"allowJs": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"alwaysStrict": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"strict": true,
|
||||||
|
"strictPropertyInitialization": true,
|
||||||
|
"lib": ["ES2020"],
|
||||||
|
"typeRoots": [
|
||||||
|
"./typings"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"./**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
/// <reference path="./types/index.d.ts" />
|
||||||
|
|
||||||
|
interface IAppOption {
|
||||||
|
globalData: {
|
||||||
|
userInfo?: WechatMiniprogram.UserInfo,
|
||||||
|
}
|
||||||
|
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback,
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
/// <reference path="./wx/index.d.ts" />
|
@ -0,0 +1,68 @@
|
|||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) 2022 Tencent, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
|
||||||
|
declare namespace WechatMiniprogram.Behavior {
|
||||||
|
type BehaviorIdentifier = string
|
||||||
|
type Instance<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends MethodOption,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||||
|
> = Component.Instance<TData, TProperty, TMethod, TCustomInstanceProperty>
|
||||||
|
type TrivialInstance = Instance<IAnyObject, IAnyObject, IAnyObject>
|
||||||
|
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject>
|
||||||
|
type Options<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends MethodOption,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||||
|
> = Partial<Data<TData>> &
|
||||||
|
Partial<Property<TProperty>> &
|
||||||
|
Partial<Method<TMethod>> &
|
||||||
|
Partial<OtherOption> &
|
||||||
|
Partial<Lifetimes> &
|
||||||
|
ThisType<Instance<TData, TProperty, TMethod, TCustomInstanceProperty>>
|
||||||
|
interface Constructor {
|
||||||
|
<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends MethodOption,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||||
|
>(
|
||||||
|
options: Options<TData, TProperty, TMethod, TCustomInstanceProperty>
|
||||||
|
): BehaviorIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataOption = Component.DataOption
|
||||||
|
type PropertyOption = Component.PropertyOption
|
||||||
|
type MethodOption = Component.MethodOption
|
||||||
|
type Data<D extends DataOption> = Component.Data<D>
|
||||||
|
type Property<P extends PropertyOption> = Component.Property<P>
|
||||||
|
type Method<M extends MethodOption> = Component.Method<M>
|
||||||
|
|
||||||
|
type DefinitionFilter = Component.DefinitionFilter
|
||||||
|
type Lifetimes = Component.Lifetimes
|
||||||
|
|
||||||
|
type OtherOption = Omit<Component.OtherOption, 'options'>
|
||||||
|
}
|
||||||
|
/** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/
|
||||||
|
declare let Behavior: WechatMiniprogram.Behavior.Constructor
|
@ -0,0 +1,979 @@
|
|||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) 2022 Tencent, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
|
||||||
|
interface IAPIError {
|
||||||
|
errMsg: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IAPIParam<T = any> {
|
||||||
|
config?: ICloudConfig
|
||||||
|
success?: (res: T) => void
|
||||||
|
fail?: (err: IAPIError) => void
|
||||||
|
complete?: (val: T | IAPIError) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IAPISuccessParam {
|
||||||
|
errMsg: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type IAPICompleteParam = IAPISuccessParam | IAPIError
|
||||||
|
|
||||||
|
type IAPIFunction<T, P extends IAPIParam<T>> = (param?: P) => Promise<T>
|
||||||
|
|
||||||
|
interface IInitCloudConfig {
|
||||||
|
env?:
|
||||||
|
| string
|
||||||
|
| {
|
||||||
|
database?: string
|
||||||
|
functions?: string
|
||||||
|
storage?: string
|
||||||
|
}
|
||||||
|
traceUser?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICloudConfig {
|
||||||
|
env?: string
|
||||||
|
traceUser?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IICloudAPI {
|
||||||
|
init: (config?: IInitCloudConfig) => void
|
||||||
|
[api: string]: AnyFunction | IAPIFunction<any, any>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICloudService {
|
||||||
|
name: string
|
||||||
|
|
||||||
|
getAPIs: () => { [name: string]: IAPIFunction<any, any> }
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICloudServices {
|
||||||
|
[serviceName: string]: ICloudService
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICloudMetaData {
|
||||||
|
session_id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
declare class InternalSymbol {}
|
||||||
|
|
||||||
|
interface AnyObject {
|
||||||
|
[x: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
type AnyArray = any[]
|
||||||
|
|
||||||
|
type AnyFunction = (...args: any[]) => any
|
||||||
|
|
||||||
|
/**
|
||||||
|
* extend wx with cloud
|
||||||
|
*/
|
||||||
|
interface WxCloud {
|
||||||
|
init: (config?: ICloudConfig) => void
|
||||||
|
|
||||||
|
callFunction(param: OQ<ICloud.CallFunctionParam>): void
|
||||||
|
callFunction(
|
||||||
|
param: RQ<ICloud.CallFunctionParam>
|
||||||
|
): Promise<ICloud.CallFunctionResult>
|
||||||
|
|
||||||
|
uploadFile(param: OQ<ICloud.UploadFileParam>): WechatMiniprogram.UploadTask
|
||||||
|
uploadFile(
|
||||||
|
param: RQ<ICloud.UploadFileParam>
|
||||||
|
): Promise<ICloud.UploadFileResult>
|
||||||
|
|
||||||
|
downloadFile(
|
||||||
|
param: OQ<ICloud.DownloadFileParam>
|
||||||
|
): WechatMiniprogram.DownloadTask
|
||||||
|
downloadFile(
|
||||||
|
param: RQ<ICloud.DownloadFileParam>
|
||||||
|
): Promise<ICloud.DownloadFileResult>
|
||||||
|
|
||||||
|
getTempFileURL(param: OQ<ICloud.GetTempFileURLParam>): void
|
||||||
|
getTempFileURL(
|
||||||
|
param: RQ<ICloud.GetTempFileURLParam>
|
||||||
|
): Promise<ICloud.GetTempFileURLResult>
|
||||||
|
|
||||||
|
deleteFile(param: OQ<ICloud.DeleteFileParam>): void
|
||||||
|
deleteFile(
|
||||||
|
param: RQ<ICloud.DeleteFileParam>
|
||||||
|
): Promise<ICloud.DeleteFileResult>
|
||||||
|
|
||||||
|
database: (config?: ICloudConfig) => DB.Database
|
||||||
|
|
||||||
|
CloudID: ICloud.ICloudIDConstructor
|
||||||
|
CDN: ICloud.ICDNConstructor
|
||||||
|
|
||||||
|
callContainer(param: OQ<ICloud.CallContainerParam>): void
|
||||||
|
callContainer(
|
||||||
|
param: RQ<ICloud.CallContainerParam>
|
||||||
|
): Promise<ICloud.CallContainerResult>
|
||||||
|
|
||||||
|
connectContainer(param: OQ<ICloud.ConnectContainerParam>): void
|
||||||
|
connectContainer(
|
||||||
|
param: RQ<ICloud.ConnectContainerParam>
|
||||||
|
): Promise<ICloud.ConnectContainerResult>
|
||||||
|
}
|
||||||
|
|
||||||
|
declare namespace ICloud {
|
||||||
|
interface ICloudAPIParam<T = any> extends IAPIParam<T> {
|
||||||
|
config?: ICloudConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// === API: callFunction ===
|
||||||
|
type CallFunctionData = AnyObject
|
||||||
|
|
||||||
|
interface CallFunctionResult extends IAPISuccessParam {
|
||||||
|
result: AnyObject | string | undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CallFunctionParam extends ICloudAPIParam<CallFunctionResult> {
|
||||||
|
name: string
|
||||||
|
data?: CallFunctionData
|
||||||
|
slow?: boolean
|
||||||
|
}
|
||||||
|
// === end ===
|
||||||
|
|
||||||
|
// === API: container ===
|
||||||
|
type CallContainerData = AnyObject
|
||||||
|
|
||||||
|
interface CallContainerResult extends IAPISuccessParam {
|
||||||
|
data: any
|
||||||
|
statusCode: number
|
||||||
|
header: Record<string, any>
|
||||||
|
callID: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CallContainerParam extends ICloudAPIParam<CallContainerResult> {
|
||||||
|
path: string
|
||||||
|
service?: string
|
||||||
|
method?: string
|
||||||
|
header?: Record<string, any>
|
||||||
|
data?: any // string, object, ArrayBuffer
|
||||||
|
dataType?: string
|
||||||
|
responseType?: string
|
||||||
|
timeout?: number
|
||||||
|
verbose?: boolean
|
||||||
|
followRedirect?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ConnectContainerResult extends IAPISuccessParam {
|
||||||
|
socketTask: WechatMiniprogram.SocketTask
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ConnectSocketOptions extends IAPIParam<void> {
|
||||||
|
header?: Record<string, string>
|
||||||
|
protocols?: string[]
|
||||||
|
tcpNoDelay?: boolean
|
||||||
|
perMessageDeflate?: boolean
|
||||||
|
timeout?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConnectContainerParam = Omit<
|
||||||
|
ConnectSocketOptions,
|
||||||
|
'success' | 'fail' | 'complete'
|
||||||
|
> &
|
||||||
|
ICloudAPIParam<ConnectContainerResult> & {
|
||||||
|
service: string
|
||||||
|
path?: string
|
||||||
|
}
|
||||||
|
// === end ===
|
||||||
|
|
||||||
|
// === API: uploadFile ===
|
||||||
|
interface UploadFileResult extends IAPISuccessParam {
|
||||||
|
fileID: string
|
||||||
|
statusCode: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UploadFileParam extends ICloudAPIParam<UploadFileResult> {
|
||||||
|
cloudPath: string
|
||||||
|
filePath: string
|
||||||
|
header?: AnyObject
|
||||||
|
}
|
||||||
|
// === end ===
|
||||||
|
|
||||||
|
// === API: downloadFile ===
|
||||||
|
interface DownloadFileResult extends IAPISuccessParam {
|
||||||
|
tempFilePath: string
|
||||||
|
statusCode: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DownloadFileParam extends ICloudAPIParam<DownloadFileResult> {
|
||||||
|
fileID: string
|
||||||
|
cloudPath?: string
|
||||||
|
}
|
||||||
|
// === end ===
|
||||||
|
|
||||||
|
// === API: getTempFileURL ===
|
||||||
|
interface GetTempFileURLResult extends IAPISuccessParam {
|
||||||
|
fileList: GetTempFileURLResultItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetTempFileURLResultItem {
|
||||||
|
fileID: string
|
||||||
|
tempFileURL: string
|
||||||
|
maxAge: number
|
||||||
|
status: number
|
||||||
|
errMsg: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetTempFileURLParam extends ICloudAPIParam<GetTempFileURLResult> {
|
||||||
|
fileList: string[]
|
||||||
|
}
|
||||||
|
// === end ===
|
||||||
|
|
||||||
|
// === API: deleteFile ===
|
||||||
|
interface DeleteFileResult extends IAPISuccessParam {
|
||||||
|
fileList: DeleteFileResultItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DeleteFileResultItem {
|
||||||
|
fileID: string
|
||||||
|
status: number
|
||||||
|
errMsg: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DeleteFileParam extends ICloudAPIParam<DeleteFileResult> {
|
||||||
|
fileList: string[]
|
||||||
|
}
|
||||||
|
// === end ===
|
||||||
|
|
||||||
|
// === API: CloudID ===
|
||||||
|
abstract class CloudID {
|
||||||
|
constructor(cloudID: string)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICloudIDConstructor {
|
||||||
|
new (cloudId: string): CloudID
|
||||||
|
(cloudId: string): CloudID
|
||||||
|
}
|
||||||
|
// === end ===
|
||||||
|
|
||||||
|
// === API: CDN ===
|
||||||
|
abstract class CDN {
|
||||||
|
target: string | ArrayBuffer | ICDNFilePathSpec
|
||||||
|
constructor(target: string | ArrayBuffer | ICDNFilePathSpec)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICDNFilePathSpec {
|
||||||
|
type: 'filePath'
|
||||||
|
filePath: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICDNConstructor {
|
||||||
|
new (options: string | ArrayBuffer | ICDNFilePathSpec): CDN
|
||||||
|
(options: string | ArrayBuffer | ICDNFilePathSpec): CDN
|
||||||
|
}
|
||||||
|
// === end ===
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Database ===
|
||||||
|
declare namespace DB {
|
||||||
|
/**
|
||||||
|
* The class of all exposed cloud database instances
|
||||||
|
*/
|
||||||
|
class Database {
|
||||||
|
readonly config: ICloudConfig
|
||||||
|
readonly command: DatabaseCommand
|
||||||
|
readonly Geo: IGeo
|
||||||
|
readonly serverDate: () => ServerDate
|
||||||
|
readonly RegExp: IRegExpConstructor
|
||||||
|
|
||||||
|
private constructor()
|
||||||
|
|
||||||
|
collection(collectionName: string): CollectionReference
|
||||||
|
}
|
||||||
|
|
||||||
|
class CollectionReference extends Query {
|
||||||
|
readonly collectionName: string
|
||||||
|
|
||||||
|
private constructor(name: string, database: Database)
|
||||||
|
|
||||||
|
doc(docId: string | number): DocumentReference
|
||||||
|
|
||||||
|
add(options: OQ<IAddDocumentOptions>): void
|
||||||
|
add(options: RQ<IAddDocumentOptions>): Promise<IAddResult>
|
||||||
|
}
|
||||||
|
|
||||||
|
class DocumentReference {
|
||||||
|
private constructor(docId: string | number, database: Database)
|
||||||
|
|
||||||
|
field(object: Record<string, any>): this
|
||||||
|
|
||||||
|
get(options: OQ<IGetDocumentOptions>): void
|
||||||
|
get(options?: RQ<IGetDocumentOptions>): Promise<IQuerySingleResult>
|
||||||
|
|
||||||
|
set(options: OQ<ISetSingleDocumentOptions>): void
|
||||||
|
set(options?: RQ<ISetSingleDocumentOptions>): Promise<ISetResult>
|
||||||
|
|
||||||
|
update(options: OQ<IUpdateSingleDocumentOptions>): void
|
||||||
|
update(
|
||||||
|
options?: RQ<IUpdateSingleDocumentOptions>
|
||||||
|
): Promise<IUpdateResult>
|
||||||
|
|
||||||
|
remove(options: OQ<IRemoveSingleDocumentOptions>): void
|
||||||
|
remove(
|
||||||
|
options?: RQ<IRemoveSingleDocumentOptions>
|
||||||
|
): Promise<IRemoveResult>
|
||||||
|
|
||||||
|
watch(options: IWatchOptions): RealtimeListener
|
||||||
|
}
|
||||||
|
|
||||||
|
class RealtimeListener {
|
||||||
|
// "And Now His Watch Is Ended"
|
||||||
|
close: () => Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
class Query {
|
||||||
|
where(condition: IQueryCondition): Query
|
||||||
|
|
||||||
|
orderBy(fieldPath: string, order: string): Query
|
||||||
|
|
||||||
|
limit(max: number): Query
|
||||||
|
|
||||||
|
skip(offset: number): Query
|
||||||
|
|
||||||
|
field(object: Record<string, any>): Query
|
||||||
|
|
||||||
|
get(options: OQ<IGetDocumentOptions>): void
|
||||||
|
get(options?: RQ<IGetDocumentOptions>): Promise<IQueryResult>
|
||||||
|
|
||||||
|
count(options: OQ<ICountDocumentOptions>): void
|
||||||
|
count(options?: RQ<ICountDocumentOptions>): Promise<ICountResult>
|
||||||
|
|
||||||
|
watch(options: IWatchOptions): RealtimeListener
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DatabaseCommand {
|
||||||
|
eq(val: any): DatabaseQueryCommand
|
||||||
|
neq(val: any): DatabaseQueryCommand
|
||||||
|
gt(val: any): DatabaseQueryCommand
|
||||||
|
gte(val: any): DatabaseQueryCommand
|
||||||
|
lt(val: any): DatabaseQueryCommand
|
||||||
|
lte(val: any): DatabaseQueryCommand
|
||||||
|
in(val: any[]): DatabaseQueryCommand
|
||||||
|
nin(val: any[]): DatabaseQueryCommand
|
||||||
|
|
||||||
|
geoNear(options: IGeoNearCommandOptions): DatabaseQueryCommand
|
||||||
|
geoWithin(options: IGeoWithinCommandOptions): DatabaseQueryCommand
|
||||||
|
geoIntersects(
|
||||||
|
options: IGeoIntersectsCommandOptions
|
||||||
|
): DatabaseQueryCommand
|
||||||
|
|
||||||
|
and(
|
||||||
|
...expressions: Array<DatabaseLogicCommand | IQueryCondition>
|
||||||
|
): DatabaseLogicCommand
|
||||||
|
or(
|
||||||
|
...expressions: Array<DatabaseLogicCommand | IQueryCondition>
|
||||||
|
): DatabaseLogicCommand
|
||||||
|
nor(
|
||||||
|
...expressions: Array<DatabaseLogicCommand | IQueryCondition>
|
||||||
|
): DatabaseLogicCommand
|
||||||
|
not(expression: DatabaseLogicCommand): DatabaseLogicCommand
|
||||||
|
|
||||||
|
exists(val: boolean): DatabaseQueryCommand
|
||||||
|
|
||||||
|
mod(divisor: number, remainder: number): DatabaseQueryCommand
|
||||||
|
|
||||||
|
all(val: any[]): DatabaseQueryCommand
|
||||||
|
elemMatch(val: any): DatabaseQueryCommand
|
||||||
|
size(val: number): DatabaseQueryCommand
|
||||||
|
|
||||||
|
set(val: any): DatabaseUpdateCommand
|
||||||
|
remove(): DatabaseUpdateCommand
|
||||||
|
inc(val: number): DatabaseUpdateCommand
|
||||||
|
mul(val: number): DatabaseUpdateCommand
|
||||||
|
min(val: number): DatabaseUpdateCommand
|
||||||
|
max(val: number): DatabaseUpdateCommand
|
||||||
|
rename(val: string): DatabaseUpdateCommand
|
||||||
|
bit(val: number): DatabaseUpdateCommand
|
||||||
|
|
||||||
|
push(...values: any[]): DatabaseUpdateCommand
|
||||||
|
pop(): DatabaseUpdateCommand
|
||||||
|
shift(): DatabaseUpdateCommand
|
||||||
|
unshift(...values: any[]): DatabaseUpdateCommand
|
||||||
|
addToSet(val: any): DatabaseUpdateCommand
|
||||||
|
pull(val: any): DatabaseUpdateCommand
|
||||||
|
pullAll(val: any): DatabaseUpdateCommand
|
||||||
|
|
||||||
|
project: {
|
||||||
|
slice(val: number | [number, number]): DatabaseProjectionCommand
|
||||||
|
}
|
||||||
|
|
||||||
|
aggregate: {
|
||||||
|
__safe_props__?: Set<string>
|
||||||
|
|
||||||
|
abs(val: any): DatabaseAggregateCommand
|
||||||
|
add(val: any): DatabaseAggregateCommand
|
||||||
|
addToSet(val: any): DatabaseAggregateCommand
|
||||||
|
allElementsTrue(val: any): DatabaseAggregateCommand
|
||||||
|
and(val: any): DatabaseAggregateCommand
|
||||||
|
anyElementTrue(val: any): DatabaseAggregateCommand
|
||||||
|
arrayElemAt(val: any): DatabaseAggregateCommand
|
||||||
|
arrayToObject(val: any): DatabaseAggregateCommand
|
||||||
|
avg(val: any): DatabaseAggregateCommand
|
||||||
|
ceil(val: any): DatabaseAggregateCommand
|
||||||
|
cmp(val: any): DatabaseAggregateCommand
|
||||||
|
concat(val: any): DatabaseAggregateCommand
|
||||||
|
concatArrays(val: any): DatabaseAggregateCommand
|
||||||
|
cond(val: any): DatabaseAggregateCommand
|
||||||
|
convert(val: any): DatabaseAggregateCommand
|
||||||
|
dateFromParts(val: any): DatabaseAggregateCommand
|
||||||
|
dateToParts(val: any): DatabaseAggregateCommand
|
||||||
|
dateFromString(val: any): DatabaseAggregateCommand
|
||||||
|
dateToString(val: any): DatabaseAggregateCommand
|
||||||
|
dayOfMonth(val: any): DatabaseAggregateCommand
|
||||||
|
dayOfWeek(val: any): DatabaseAggregateCommand
|
||||||
|
dayOfYear(val: any): DatabaseAggregateCommand
|
||||||
|
divide(val: any): DatabaseAggregateCommand
|
||||||
|
eq(val: any): DatabaseAggregateCommand
|
||||||
|
exp(val: any): DatabaseAggregateCommand
|
||||||
|
filter(val: any): DatabaseAggregateCommand
|
||||||
|
first(val: any): DatabaseAggregateCommand
|
||||||
|
floor(val: any): DatabaseAggregateCommand
|
||||||
|
gt(val: any): DatabaseAggregateCommand
|
||||||
|
gte(val: any): DatabaseAggregateCommand
|
||||||
|
hour(val: any): DatabaseAggregateCommand
|
||||||
|
ifNull(val: any): DatabaseAggregateCommand
|
||||||
|
in(val: any): DatabaseAggregateCommand
|
||||||
|
indexOfArray(val: any): DatabaseAggregateCommand
|
||||||
|
indexOfBytes(val: any): DatabaseAggregateCommand
|
||||||
|
indexOfCP(val: any): DatabaseAggregateCommand
|
||||||
|
isArray(val: any): DatabaseAggregateCommand
|
||||||
|
isoDayOfWeek(val: any): DatabaseAggregateCommand
|
||||||
|
isoWeek(val: any): DatabaseAggregateCommand
|
||||||
|
isoWeekYear(val: any): DatabaseAggregateCommand
|
||||||
|
last(val: any): DatabaseAggregateCommand
|
||||||
|
let(val: any): DatabaseAggregateCommand
|
||||||
|
literal(val: any): DatabaseAggregateCommand
|
||||||
|
ln(val: any): DatabaseAggregateCommand
|
||||||
|
log(val: any): DatabaseAggregateCommand
|
||||||
|
log10(val: any): DatabaseAggregateCommand
|
||||||
|
lt(val: any): DatabaseAggregateCommand
|
||||||
|
lte(val: any): DatabaseAggregateCommand
|
||||||
|
ltrim(val: any): DatabaseAggregateCommand
|
||||||
|
map(val: any): DatabaseAggregateCommand
|
||||||
|
max(val: any): DatabaseAggregateCommand
|
||||||
|
mergeObjects(val: any): DatabaseAggregateCommand
|
||||||
|
meta(val: any): DatabaseAggregateCommand
|
||||||
|
min(val: any): DatabaseAggregateCommand
|
||||||
|
millisecond(val: any): DatabaseAggregateCommand
|
||||||
|
minute(val: any): DatabaseAggregateCommand
|
||||||
|
mod(val: any): DatabaseAggregateCommand
|
||||||
|
month(val: any): DatabaseAggregateCommand
|
||||||
|
multiply(val: any): DatabaseAggregateCommand
|
||||||
|
neq(val: any): DatabaseAggregateCommand
|
||||||
|
not(val: any): DatabaseAggregateCommand
|
||||||
|
objectToArray(val: any): DatabaseAggregateCommand
|
||||||
|
or(val: any): DatabaseAggregateCommand
|
||||||
|
pow(val: any): DatabaseAggregateCommand
|
||||||
|
push(val: any): DatabaseAggregateCommand
|
||||||
|
range(val: any): DatabaseAggregateCommand
|
||||||
|
reduce(val: any): DatabaseAggregateCommand
|
||||||
|
reverseArray(val: any): DatabaseAggregateCommand
|
||||||
|
rtrim(val: any): DatabaseAggregateCommand
|
||||||
|
second(val: any): DatabaseAggregateCommand
|
||||||
|
setDifference(val: any): DatabaseAggregateCommand
|
||||||
|
setEquals(val: any): DatabaseAggregateCommand
|
||||||
|
setIntersection(val: any): DatabaseAggregateCommand
|
||||||
|
setIsSubset(val: any): DatabaseAggregateCommand
|
||||||
|
setUnion(val: any): DatabaseAggregateCommand
|
||||||
|
size(val: any): DatabaseAggregateCommand
|
||||||
|
slice(val: any): DatabaseAggregateCommand
|
||||||
|
split(val: any): DatabaseAggregateCommand
|
||||||
|
sqrt(val: any): DatabaseAggregateCommand
|
||||||
|
stdDevPop(val: any): DatabaseAggregateCommand
|
||||||
|
stdDevSamp(val: any): DatabaseAggregateCommand
|
||||||
|
strcasecmp(val: any): DatabaseAggregateCommand
|
||||||
|
strLenBytes(val: any): DatabaseAggregateCommand
|
||||||
|
strLenCP(val: any): DatabaseAggregateCommand
|
||||||
|
substr(val: any): DatabaseAggregateCommand
|
||||||
|
substrBytes(val: any): DatabaseAggregateCommand
|
||||||
|
substrCP(val: any): DatabaseAggregateCommand
|
||||||
|
subtract(val: any): DatabaseAggregateCommand
|
||||||
|
sum(val: any): DatabaseAggregateCommand
|
||||||
|
switch(val: any): DatabaseAggregateCommand
|
||||||
|
toBool(val: any): DatabaseAggregateCommand
|
||||||
|
toDate(val: any): DatabaseAggregateCommand
|
||||||
|
toDecimal(val: any): DatabaseAggregateCommand
|
||||||
|
toDouble(val: any): DatabaseAggregateCommand
|
||||||
|
toInt(val: any): DatabaseAggregateCommand
|
||||||
|
toLong(val: any): DatabaseAggregateCommand
|
||||||
|
toObjectId(val: any): DatabaseAggregateCommand
|
||||||
|
toString(val: any): DatabaseAggregateCommand
|
||||||
|
toLower(val: any): DatabaseAggregateCommand
|
||||||
|
toUpper(val: any): DatabaseAggregateCommand
|
||||||
|
trim(val: any): DatabaseAggregateCommand
|
||||||
|
trunc(val: any): DatabaseAggregateCommand
|
||||||
|
type(val: any): DatabaseAggregateCommand
|
||||||
|
week(val: any): DatabaseAggregateCommand
|
||||||
|
year(val: any): DatabaseAggregateCommand
|
||||||
|
zip(val: any): DatabaseAggregateCommand
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DatabaseAggregateCommand {}
|
||||||
|
|
||||||
|
enum LOGIC_COMMANDS_LITERAL {
|
||||||
|
AND = 'and',
|
||||||
|
OR = 'or',
|
||||||
|
NOT = 'not',
|
||||||
|
NOR = 'nor'
|
||||||
|
}
|
||||||
|
|
||||||
|
class DatabaseLogicCommand {
|
||||||
|
and(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand
|
||||||
|
or(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand
|
||||||
|
nor(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand
|
||||||
|
not(expression: DatabaseLogicCommand): DatabaseLogicCommand
|
||||||
|
}
|
||||||
|
|
||||||
|
enum QUERY_COMMANDS_LITERAL {
|
||||||
|
// comparison
|
||||||
|
EQ = 'eq',
|
||||||
|
NEQ = 'neq',
|
||||||
|
GT = 'gt',
|
||||||
|
GTE = 'gte',
|
||||||
|
LT = 'lt',
|
||||||
|
LTE = 'lte',
|
||||||
|
IN = 'in',
|
||||||
|
NIN = 'nin',
|
||||||
|
// geo
|
||||||
|
GEO_NEAR = 'geoNear',
|
||||||
|
GEO_WITHIN = 'geoWithin',
|
||||||
|
GEO_INTERSECTS = 'geoIntersects',
|
||||||
|
// element
|
||||||
|
EXISTS = 'exists',
|
||||||
|
// evaluation
|
||||||
|
MOD = 'mod',
|
||||||
|
// array
|
||||||
|
ALL = 'all',
|
||||||
|
ELEM_MATCH = 'elemMatch',
|
||||||
|
SIZE = 'size'
|
||||||
|
}
|
||||||
|
|
||||||
|
class DatabaseQueryCommand extends DatabaseLogicCommand {
|
||||||
|
eq(val: any): DatabaseLogicCommand
|
||||||
|
neq(val: any): DatabaseLogicCommand
|
||||||
|
gt(val: any): DatabaseLogicCommand
|
||||||
|
gte(val: any): DatabaseLogicCommand
|
||||||
|
lt(val: any): DatabaseLogicCommand
|
||||||
|
lte(val: any): DatabaseLogicCommand
|
||||||
|
in(val: any[]): DatabaseLogicCommand
|
||||||
|
nin(val: any[]): DatabaseLogicCommand
|
||||||
|
|
||||||
|
exists(val: boolean): DatabaseLogicCommand
|
||||||
|
|
||||||
|
mod(divisor: number, remainder: number): DatabaseLogicCommand
|
||||||
|
|
||||||
|
all(val: any[]): DatabaseLogicCommand
|
||||||
|
elemMatch(val: any): DatabaseLogicCommand
|
||||||
|
size(val: number): DatabaseLogicCommand
|
||||||
|
|
||||||
|
geoNear(options: IGeoNearCommandOptions): DatabaseLogicCommand
|
||||||
|
geoWithin(options: IGeoWithinCommandOptions): DatabaseLogicCommand
|
||||||
|
geoIntersects(
|
||||||
|
options: IGeoIntersectsCommandOptions
|
||||||
|
): DatabaseLogicCommand
|
||||||
|
}
|
||||||
|
|
||||||
|
enum PROJECTION_COMMANDS_LITERAL {
|
||||||
|
SLICE = 'slice'
|
||||||
|
}
|
||||||
|
|
||||||
|
class DatabaseProjectionCommand {}
|
||||||
|
|
||||||
|
enum UPDATE_COMMANDS_LITERAL {
|
||||||
|
// field
|
||||||
|
SET = 'set',
|
||||||
|
REMOVE = 'remove',
|
||||||
|
INC = 'inc',
|
||||||
|
MUL = 'mul',
|
||||||
|
MIN = 'min',
|
||||||
|
MAX = 'max',
|
||||||
|
RENAME = 'rename',
|
||||||
|
// bitwise
|
||||||
|
BIT = 'bit',
|
||||||
|
// array
|
||||||
|
PUSH = 'push',
|
||||||
|
POP = 'pop',
|
||||||
|
SHIFT = 'shift',
|
||||||
|
UNSHIFT = 'unshift',
|
||||||
|
ADD_TO_SET = 'addToSet',
|
||||||
|
PULL = 'pull',
|
||||||
|
PULL_ALL = 'pullAll'
|
||||||
|
}
|
||||||
|
|
||||||
|
class DatabaseUpdateCommand {}
|
||||||
|
|
||||||
|
class Batch {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A contract that all API provider must adhere to
|
||||||
|
*/
|
||||||
|
class APIBaseContract<
|
||||||
|
PromiseReturn,
|
||||||
|
CallbackReturn,
|
||||||
|
Param extends IAPIParam,
|
||||||
|
Context = any
|
||||||
|
> {
|
||||||
|
getContext(param: Param): Context
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In case of callback-style invocation, this function will be called
|
||||||
|
*/
|
||||||
|
getCallbackReturn(param: Param, context: Context): CallbackReturn
|
||||||
|
|
||||||
|
getFinalParam<T extends Param>(param: Param, context: Context): T
|
||||||
|
|
||||||
|
run<T extends Param>(param: T): Promise<PromiseReturn>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoPointConstructor {
|
||||||
|
new (longitude: number, latitide: number): GeoPoint
|
||||||
|
new (geojson: IGeoJSONPoint): GeoPoint
|
||||||
|
(longitude: number, latitide: number): GeoPoint
|
||||||
|
(geojson: IGeoJSONPoint): GeoPoint
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoMultiPointConstructor {
|
||||||
|
new (points: GeoPoint[] | IGeoJSONMultiPoint): GeoMultiPoint
|
||||||
|
(points: GeoPoint[] | IGeoJSONMultiPoint): GeoMultiPoint
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoLineStringConstructor {
|
||||||
|
new (points: GeoPoint[] | IGeoJSONLineString): GeoLineString
|
||||||
|
(points: GeoPoint[] | IGeoJSONLineString): GeoLineString
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoMultiLineStringConstructor {
|
||||||
|
new (
|
||||||
|
lineStrings: GeoLineString[] | IGeoJSONMultiLineString
|
||||||
|
): GeoMultiLineString
|
||||||
|
(
|
||||||
|
lineStrings: GeoLineString[] | IGeoJSONMultiLineString
|
||||||
|
): GeoMultiLineString
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoPolygonConstructor {
|
||||||
|
new (lineStrings: GeoLineString[] | IGeoJSONPolygon): GeoPolygon
|
||||||
|
(lineStrings: GeoLineString[] | IGeoJSONPolygon): GeoPolygon
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoMultiPolygonConstructor {
|
||||||
|
new (polygons: GeoPolygon[] | IGeoJSONMultiPolygon): GeoMultiPolygon
|
||||||
|
(polygons: GeoPolygon[] | IGeoJSONMultiPolygon): GeoMultiPolygon
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeo {
|
||||||
|
Point: IGeoPointConstructor
|
||||||
|
MultiPoint: IGeoMultiPointConstructor
|
||||||
|
LineString: IGeoLineStringConstructor
|
||||||
|
MultiLineString: IGeoMultiLineStringConstructor
|
||||||
|
Polygon: IGeoPolygonConstructor
|
||||||
|
MultiPolygon: IGeoMultiPolygonConstructor
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoJSONPoint {
|
||||||
|
type: 'Point'
|
||||||
|
coordinates: [number, number]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoJSONMultiPoint {
|
||||||
|
type: 'MultiPoint'
|
||||||
|
coordinates: Array<[number, number]>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoJSONLineString {
|
||||||
|
type: 'LineString'
|
||||||
|
coordinates: Array<[number, number]>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoJSONMultiLineString {
|
||||||
|
type: 'MultiLineString'
|
||||||
|
coordinates: Array<Array<[number, number]>>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoJSONPolygon {
|
||||||
|
type: 'Polygon'
|
||||||
|
coordinates: Array<Array<[number, number]>>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoJSONMultiPolygon {
|
||||||
|
type: 'MultiPolygon'
|
||||||
|
coordinates: Array<Array<Array<[number, number]>>>
|
||||||
|
}
|
||||||
|
|
||||||
|
type IGeoJSONObject =
|
||||||
|
| IGeoJSONPoint
|
||||||
|
| IGeoJSONMultiPoint
|
||||||
|
| IGeoJSONLineString
|
||||||
|
| IGeoJSONMultiLineString
|
||||||
|
| IGeoJSONPolygon
|
||||||
|
| IGeoJSONMultiPolygon
|
||||||
|
|
||||||
|
abstract class GeoPoint {
|
||||||
|
longitude: number
|
||||||
|
latitude: number
|
||||||
|
|
||||||
|
constructor(longitude: number, latitude: number)
|
||||||
|
|
||||||
|
toJSON(): Record<string, any>
|
||||||
|
toString(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class GeoMultiPoint {
|
||||||
|
points: GeoPoint[]
|
||||||
|
|
||||||
|
constructor(points: GeoPoint[])
|
||||||
|
|
||||||
|
toJSON(): IGeoJSONMultiPoint
|
||||||
|
toString(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class GeoLineString {
|
||||||
|
points: GeoPoint[]
|
||||||
|
|
||||||
|
constructor(points: GeoPoint[])
|
||||||
|
|
||||||
|
toJSON(): IGeoJSONLineString
|
||||||
|
toString(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class GeoMultiLineString {
|
||||||
|
lines: GeoLineString[]
|
||||||
|
|
||||||
|
constructor(lines: GeoLineString[])
|
||||||
|
|
||||||
|
toJSON(): IGeoJSONMultiLineString
|
||||||
|
toString(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class GeoPolygon {
|
||||||
|
lines: GeoLineString[]
|
||||||
|
|
||||||
|
constructor(lines: GeoLineString[])
|
||||||
|
|
||||||
|
toJSON(): IGeoJSONPolygon
|
||||||
|
toString(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class GeoMultiPolygon {
|
||||||
|
polygons: GeoPolygon[]
|
||||||
|
|
||||||
|
constructor(polygons: GeoPolygon[])
|
||||||
|
|
||||||
|
toJSON(): IGeoJSONMultiPolygon
|
||||||
|
toString(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
type GeoInstance =
|
||||||
|
| GeoPoint
|
||||||
|
| GeoMultiPoint
|
||||||
|
| GeoLineString
|
||||||
|
| GeoMultiLineString
|
||||||
|
| GeoPolygon
|
||||||
|
| GeoMultiPolygon
|
||||||
|
|
||||||
|
interface IGeoNearCommandOptions {
|
||||||
|
geometry: GeoPoint
|
||||||
|
maxDistance?: number
|
||||||
|
minDistance?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoWithinCommandOptions {
|
||||||
|
geometry: GeoPolygon | GeoMultiPolygon
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IGeoIntersectsCommandOptions {
|
||||||
|
geometry:
|
||||||
|
| GeoPoint
|
||||||
|
| GeoMultiPoint
|
||||||
|
| GeoLineString
|
||||||
|
| GeoMultiLineString
|
||||||
|
| GeoPolygon
|
||||||
|
| GeoMultiPolygon
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IServerDateOptions {
|
||||||
|
offset: number
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class ServerDate {
|
||||||
|
readonly options: IServerDateOptions
|
||||||
|
constructor(options?: IServerDateOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IRegExpOptions {
|
||||||
|
regexp: string
|
||||||
|
options?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IRegExpConstructor {
|
||||||
|
new (options: IRegExpOptions): RegExp
|
||||||
|
(options: IRegExpOptions): RegExp
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class RegExp {
|
||||||
|
readonly regexp: string
|
||||||
|
readonly options: string
|
||||||
|
constructor(options: IRegExpOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DocumentId = string | number
|
||||||
|
|
||||||
|
interface IDocumentData {
|
||||||
|
_id?: DocumentId
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
type IDBAPIParam = IAPIParam
|
||||||
|
|
||||||
|
interface IAddDocumentOptions extends IDBAPIParam {
|
||||||
|
data: IDocumentData
|
||||||
|
}
|
||||||
|
|
||||||
|
type IGetDocumentOptions = IDBAPIParam
|
||||||
|
|
||||||
|
type ICountDocumentOptions = IDBAPIParam
|
||||||
|
|
||||||
|
interface IUpdateDocumentOptions extends IDBAPIParam {
|
||||||
|
data: IUpdateCondition
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUpdateSingleDocumentOptions extends IDBAPIParam {
|
||||||
|
data: IUpdateCondition
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ISetDocumentOptions extends IDBAPIParam {
|
||||||
|
data: IUpdateCondition
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ISetSingleDocumentOptions extends IDBAPIParam {
|
||||||
|
data: IUpdateCondition
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IRemoveDocumentOptions extends IDBAPIParam {
|
||||||
|
query: IQueryCondition
|
||||||
|
}
|
||||||
|
|
||||||
|
type IRemoveSingleDocumentOptions = IDBAPIParam
|
||||||
|
|
||||||
|
interface IWatchOptions {
|
||||||
|
// server realtime data init & change event
|
||||||
|
onChange: (snapshot: ISnapshot) => void
|
||||||
|
// error while connecting / listening
|
||||||
|
onError: (error: any) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ISnapshot {
|
||||||
|
id: number
|
||||||
|
docChanges: ISingleDBEvent[]
|
||||||
|
docs: Record<string, any>
|
||||||
|
type?: SnapshotType
|
||||||
|
}
|
||||||
|
|
||||||
|
type SnapshotType = 'init'
|
||||||
|
|
||||||
|
interface ISingleDBEvent {
|
||||||
|
id: number
|
||||||
|
dataType: DataType
|
||||||
|
queueType: QueueType
|
||||||
|
docId: string
|
||||||
|
doc: Record<string, any>
|
||||||
|
updatedFields?: Record<string, any>
|
||||||
|
removedFields?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataType = 'init' | 'update' | 'replace' | 'add' | 'remove' | 'limit'
|
||||||
|
|
||||||
|
type QueueType = 'init' | 'enqueue' | 'dequeue' | 'update'
|
||||||
|
|
||||||
|
interface IQueryCondition {
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
type IStringQueryCondition = string
|
||||||
|
|
||||||
|
interface IQueryResult extends IAPISuccessParam {
|
||||||
|
data: IDocumentData[]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IQuerySingleResult extends IAPISuccessParam {
|
||||||
|
data: IDocumentData
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUpdateCondition {
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
type IStringUpdateCondition = string
|
||||||
|
|
||||||
|
interface IAddResult extends IAPISuccessParam {
|
||||||
|
_id: DocumentId
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUpdateResult extends IAPISuccessParam {
|
||||||
|
stats: {
|
||||||
|
updated: number
|
||||||
|
// created: number,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ISetResult extends IAPISuccessParam {
|
||||||
|
_id: DocumentId
|
||||||
|
stats: {
|
||||||
|
updated: number
|
||||||
|
created: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IRemoveResult extends IAPISuccessParam {
|
||||||
|
stats: {
|
||||||
|
removed: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICountResult extends IAPISuccessParam {
|
||||||
|
total: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Optional<T> = { [K in keyof T]+?: T[K] }
|
||||||
|
|
||||||
|
type OQ<
|
||||||
|
T extends Optional<
|
||||||
|
Record<'complete' | 'success' | 'fail', (...args: any[]) => any>
|
||||||
|
>
|
||||||
|
> =
|
||||||
|
| (RQ<T> & Required<Pick<T, 'success'>>)
|
||||||
|
| (RQ<T> & Required<Pick<T, 'fail'>>)
|
||||||
|
| (RQ<T> & Required<Pick<T, 'complete'>>)
|
||||||
|
| (RQ<T> & Required<Pick<T, 'success' | 'fail'>>)
|
||||||
|
| (RQ<T> & Required<Pick<T, 'success' | 'complete'>>)
|
||||||
|
| (RQ<T> & Required<Pick<T, 'fail' | 'complete'>>)
|
||||||
|
| (RQ<T> & Required<Pick<T, 'fail' | 'complete' | 'success'>>)
|
||||||
|
|
||||||
|
type RQ<
|
||||||
|
T extends Optional<
|
||||||
|
Record<'complete' | 'success' | 'fail', (...args: any[]) => any>
|
||||||
|
>
|
||||||
|
> = Pick<T, Exclude<keyof T, 'complete' | 'success' | 'fail'>>
|