reyserver 1.1.36__py3-none-any.whl → 1.1.37__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reyserver/__init__.py +1 -0
- reyserver/rall.py +1 -0
- reyserver/rbase.py +7 -0
- reyserver/rfile.py +79 -0
- reyserver/rserver.py +6 -16
- {reyserver-1.1.36.dist-info → reyserver-1.1.37.dist-info}/METADATA +1 -1
- reyserver-1.1.37.dist-info/RECORD +9 -0
- reyserver-1.1.36.dist-info/RECORD +0 -8
- {reyserver-1.1.36.dist-info → reyserver-1.1.37.dist-info}/WHEEL +0 -0
- {reyserver-1.1.36.dist-info → reyserver-1.1.37.dist-info}/licenses/LICENSE +0 -0
reyserver/__init__.py
CHANGED
reyserver/rall.py
CHANGED
reyserver/rbase.py
CHANGED
reyserver/rfile.py
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# !/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
"""
|
5
|
+
@Time : 2025-10-06 18:23:51
|
6
|
+
@Author : Rey
|
7
|
+
@Contact : reyxbo@163.com
|
8
|
+
@Explain : File methods.
|
9
|
+
"""
|
10
|
+
|
11
|
+
|
12
|
+
from fastapi import APIRouter
|
13
|
+
from reydb import rorm
|
14
|
+
|
15
|
+
from . import rserver
|
16
|
+
from .rbase import ServerAPI
|
17
|
+
|
18
|
+
|
19
|
+
__all__ = (
|
20
|
+
'ServerAPIFile',
|
21
|
+
)
|
22
|
+
|
23
|
+
|
24
|
+
# class ServerAPIFile(ServerAPI):
|
25
|
+
# """
|
26
|
+
# Server File API type.
|
27
|
+
# """
|
28
|
+
|
29
|
+
|
30
|
+
# def __init__(self, server: 'rserver.Server') -> None:
|
31
|
+
# """
|
32
|
+
# Build instance attributes.
|
33
|
+
|
34
|
+
# Parameters
|
35
|
+
# ----------
|
36
|
+
# server : Server instance.
|
37
|
+
# """
|
38
|
+
|
39
|
+
# # Build.
|
40
|
+
# self.server = server
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
class DatabaseORMTableInfo(rorm.Model, table=True):
|
45
|
+
"""
|
46
|
+
Database `info` table model.
|
47
|
+
"""
|
48
|
+
|
49
|
+
__name__ = 'info'
|
50
|
+
__comment__ = 'File information table.'
|
51
|
+
create_time: rorm.Datetime = rorm.Field(field_default=':create_time', not_null=True, index_n=True, comment='Record create time.')
|
52
|
+
field_id: int = rorm.Field(rorm.types_mysql.MEDIUMINT(unsigned=True), key_auto=True, comment='File self increase ID.')
|
53
|
+
md5: str = rorm.Field(rorm.types.CHAR(32), not_null=True, index_n=True, comment='File MD5.')
|
54
|
+
name: str = rorm.Field(rorm.types.VARCHAR(260), index_n=True, comment='File name.')
|
55
|
+
note: str = rorm.Field(rorm.types.VARCHAR(500), comment='File note.')
|
56
|
+
|
57
|
+
|
58
|
+
class DatabaseORMTableData(rorm.Model, table=True):
|
59
|
+
"""
|
60
|
+
Database `data` table model.
|
61
|
+
"""
|
62
|
+
|
63
|
+
__name__ = 'data'
|
64
|
+
__comment__ = 'File data table.'
|
65
|
+
md5: str = rorm.Field(rorm.types.CHAR(32), key=True, comment='File MD5.')
|
66
|
+
size: int = rorm.Field(rorm.types_mysql.INTEGER(unsigned=True), not_null=True, comment='File bytes size.')
|
67
|
+
path: str = rorm.Field(rorm.types.VARCHAR(4095), not_null=True, comment='File disk storage path.')
|
68
|
+
|
69
|
+
|
70
|
+
router = APIRouter()
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
@router.get('/{file_id}')
|
75
|
+
def get_file_info(): ...
|
76
|
+
|
77
|
+
@router.get('/{}/bytes')
|
78
|
+
def get_file_bytes(): ...
|
79
|
+
|
reyserver/rserver.py
CHANGED
@@ -11,21 +11,14 @@
|
|
11
11
|
|
12
12
|
from typing import Literal
|
13
13
|
from collections.abc import Sequence, Callable, Coroutine
|
14
|
-
from
|
15
|
-
from inspect import iscoroutinefunction, iscoroutine
|
16
|
-
from fastapi import FastAPI, Depends as get_depends
|
17
|
-
from fastapi.params import Depends
|
18
|
-
# from fastapi.middleware.cors import CORSMiddleware
|
14
|
+
from fastapi import FastAPI
|
19
15
|
from fastapi.middleware.gzip import GZipMiddleware
|
20
|
-
from fastapi.middleware.trustedhost import TrustedHostMiddleware
|
21
|
-
from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware
|
22
16
|
from fastapi.staticfiles import StaticFiles
|
23
17
|
from uvicorn import run as uvicorn_run
|
24
|
-
from
|
25
|
-
from reykit.ros import File, Folder
|
26
|
-
from reykit.rbase import CoroutineFunction
|
18
|
+
from reykit.rbase import CoroutineFunctionSimple
|
27
19
|
|
28
20
|
from .rbase import ServerBase
|
21
|
+
from .rfile import ServerAPIFile
|
29
22
|
|
30
23
|
|
31
24
|
__all__ = (
|
@@ -33,9 +26,6 @@ __all__ = (
|
|
33
26
|
)
|
34
27
|
|
35
28
|
|
36
|
-
type CoroutineFunction = Callable[[], Coroutine]
|
37
|
-
|
38
|
-
|
39
29
|
class Server(ServerBase):
|
40
30
|
"""
|
41
31
|
Server type.
|
@@ -46,9 +36,9 @@ class Server(ServerBase):
|
|
46
36
|
def __init__(
|
47
37
|
self,
|
48
38
|
public: str | None = None,
|
49
|
-
depend:
|
50
|
-
before:
|
51
|
-
after:
|
39
|
+
depend: CoroutineFunctionSimple | Sequence[CoroutineFunctionSimple] | None = None,
|
40
|
+
before: CoroutineFunctionSimple | Sequence[CoroutineFunctionSimple] | None = None,
|
41
|
+
after: CoroutineFunctionSimple | Sequence[CoroutineFunctionSimple] | None = None,
|
52
42
|
ssl_cert: str | None = None,
|
53
43
|
ssl_key: str | None = None,
|
54
44
|
) -> None:
|
@@ -0,0 +1,9 @@
|
|
1
|
+
reyserver/__init__.py,sha256=ZNzM6wBvBSXe1LgV40ZJ1WIAbejWNYGl8x22dmt8C60,289
|
2
|
+
reyserver/rall.py,sha256=F-vUJIf5DgP0FXI0pdTrEeEiMtN-g81_yTo4ibUL9xk,233
|
3
|
+
reyserver/rbase.py,sha256=TtCmqjofwKkE0vdOIc5WhWxbgAUd8pFgx26-VON11yA,397
|
4
|
+
reyserver/rfile.py,sha256=j4-X1WJPhiYXLvojMUBVEitlPTlSTKWgIb4uJSeMK6k,1989
|
5
|
+
reyserver/rserver.py,sha256=PopXz0gu1c36FRgrpvT13BWFCOVwctb-JAlcFmocdjI,2580
|
6
|
+
reyserver-1.1.37.dist-info/METADATA,sha256=DO6G-zowwi8w6vI74KWig-jtL6Zsz3hsrjZQ-j5ioQM,1549
|
7
|
+
reyserver-1.1.37.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
+
reyserver-1.1.37.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
9
|
+
reyserver-1.1.37.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
reyserver/__init__.py,sha256=xNiwJwOqcsCbTODxZict7-MsU0cWlzYuIEE770o9-VI,266
|
2
|
-
reyserver/rall.py,sha256=4z6iHnQ43Y1UYOLoNdPN117h5LKNUWm6fhOZ5-QJK8w,211
|
3
|
-
reyserver/rbase.py,sha256=TANYMgAdpgCZoMv3WK72rARo0zNQeCFcraWYXZu96WI,306
|
4
|
-
reyserver/rserver.py,sha256=AYAB5wXObhuFrC3prz_MYyXOKadCX2hMR-llxHSF6mI,2976
|
5
|
-
reyserver-1.1.36.dist-info/METADATA,sha256=4AvsxMuZ11NmQuM4C3DH69sqyhvhSsp4ApIzr-GXS0Y,1549
|
6
|
-
reyserver-1.1.36.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
7
|
-
reyserver-1.1.36.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
8
|
-
reyserver-1.1.36.dist-info/RECORD,,
|
File without changes
|
File without changes
|