-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yanghua
committed
Feb 7, 2025
1 parent
1e6b778
commit 6728bcb
Showing
30 changed files
with
638 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
use std::sync::Arc; | ||
|
||
use axum::Router; | ||
|
||
use crate::AppState; | ||
|
||
pub mod auth; | ||
pub mod user; | ||
|
||
pub fn new() -> Router<Arc<AppState>> { | ||
Router::new() | ||
.nest("/api/auth", auth::new()) | ||
.nest("/api/user", user::new()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use std::sync::Arc; | ||
|
||
use axum::{extract::State, routing::put, Router}; | ||
|
||
use crate::AppState; | ||
|
||
pub fn new() -> Router<Arc<AppState>> { | ||
Router::new().route("/", put(registry)) | ||
} | ||
|
||
async fn registry(State(app_state): State<Arc<AppState>>) -> String { | ||
// 提取用户名与密码 | ||
let result: Result<(i64,), sqlx::Error> = sqlx::query_as("select $1") | ||
.bind(86_i64) | ||
.fetch_one(&app_state.pool) | ||
.await; | ||
|
||
if let Ok(row) = result { | ||
return format!("{}", row.0); | ||
} | ||
|
||
String::from("LPL") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod db; | ||
pub mod user; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package inline | ||
|
||
import "regexp" | ||
|
||
const ( | ||
MemoRegexp = `^@\[(.*)\]` | ||
) | ||
|
||
func FindMemoIndex(texts []byte) (Indexes, bool) { | ||
re, _ := regexp.Compile(MemoRegexp) | ||
|
||
matches := re.FindSubmatchIndex(texts) | ||
|
||
if len(matches) == 4 { | ||
return Indexes{ | ||
Indexes: matches, | ||
Type: MemoLink, | ||
Matches: matches[2:], | ||
}, true | ||
} | ||
return Indexes{}, false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.