mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-26 15:07:03 +01:00
17 lines
773 B
Python
17 lines
773 B
Python
|
from titanembeds.database import db, Base
|
||
|
import datetime
|
||
|
|
||
|
class KeyValueProperties(Base):
|
||
|
__tablename__ = "keyvalue_properties"
|
||
|
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
||
|
key = db.Column(db.String(255), nullable=False) # Property Key
|
||
|
value = db.Column(db.Text()) # Property value
|
||
|
expiration = db.Column(db.TIMESTAMP) # Suggested Expiration for value (None = no expire) in secs
|
||
|
|
||
|
def __init__(self, key, value, expiration=None):
|
||
|
self.key = key
|
||
|
self.value = value
|
||
|
if expiration:
|
||
|
self.expiration = datetime.now() + timedelta(seconds = expiration)
|
||
|
else:
|
||
|
self.expiration = None
|