Files
LuskiServer/LuskiServer/Classes/TableDef/Channels.cs
JacobTech 397d50e062 Library Update
The project now uses the new source generator package for the ServerDatabase package. This now allows code to read a full row at a time while using the type safety from the column definitions.
2023-06-16 14:24:24 -04:00

35 lines
2.2 KiB
C#

using System.Text;
using JacobTechEncryption.Enums;
using LuskiServer.Enums;
using ServerDatabase;
using ServerDatabase.SourceGenerator;
namespace LuskiServer.Classes.TableDef;
public static class Channels
{
public static TableColumn<long> ID { get; } = new("id", true);
public static TableColumn<long> Parent { get; } = new("parent") { DefaultValue = -1 };
public static TableColumn<ChannelType> Type { get; } = new("type");
public static TableColumn<DateTime> Epoch { get; } = new("epoch");
public static TableColumn<byte[]> Name { get; } = new("name") { DefaultValue = Encoding.UTF8.GetBytes("New Channel") };
public static TableColumn<byte[]> Description { get; } = new("description") { DefaultValue = Encoding.UTF8.GetBytes("New Channel") };
public static TableColumn<string> Key { get; } = new("key") { DefaultValue = string.Empty };
public static TableColumn<long[]> RoleOverides { get; } = new("role_overides") { DefaultValue = Array.Empty<long>() };
public static TableColumn<long[]> UserOverides { get; } = new("member_overides") { DefaultValue = Array.Empty<long>() };
public static TableColumn<EncryptionType> TitleEncryptionType { get; } = new("title_encryption_type") { DefaultValue = EncryptionType.None };
public static TableColumn<EncryptionType> DescriptionEncryptionType { get; } = new("description_encryption_type") { DefaultValue = EncryptionType.None };
public static TableColumn<EncryptionType[]> AllowedEncryptionTypes { get; } = new("allowed_encryption_types") { DefaultValue = new [] { EncryptionType.RSA } };
public static TableColumn<EncoderType> TitleEncoderType { get; } = new("title_encoder_type") { DefaultValue = EncoderType.UTF8 };
public static TableColumn<EncoderType> DescriptionEncoderType { get; } = new("description_encoder_type") { DefaultValue = EncoderType.UTF8 };
public static TableColumn<EncoderType[]> AllowedEncoderTypes { get; } = new("allowed_encoder_types") { DefaultValue = new []
{
EncoderType.UTF8, EncoderType.UTF16,
EncoderType.UTF32, EncoderType.ASCII,
EncoderType.Latin1, EncoderType.BigEndianUnicode
} };
}
[TableRow(typeof(Channels))]
public partial class ChannelRow
{}