초기커밋
This commit is contained in:
111
ServerCommon/Doc/OwnerContents/FriendDoc.cs
Normal file
111
ServerCommon/Doc/OwnerContents/FriendDoc.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
|
||||
|
||||
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class FriendAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty("friend_guid")]
|
||||
public string FriendGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("folder_name")]
|
||||
public string FolderName { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("is_new")]
|
||||
public Int32 IsNew { get; set; } = 0;
|
||||
|
||||
[JsonProperty("create_time")]
|
||||
public DateTime CreateTime { get; set; } = DateTimeHelper.MinTime;
|
||||
|
||||
public void cloenAttrib(ref FriendAttrib attrib)
|
||||
{
|
||||
attrib.FriendGuid = FriendGuid;
|
||||
attrib.FolderName = FolderName;
|
||||
attrib.IsNew = IsNew;
|
||||
attrib.CreateTime = CreateTime;
|
||||
}
|
||||
|
||||
public FriendAttrib()
|
||||
: base(typeof(FriendAttrib).Name)
|
||||
{ }
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "friend#owner_guid"
|
||||
// SK(Sort Key) : "friend_guid"
|
||||
// DocType : FriendInfoDoc
|
||||
// FriendAttrib : {}
|
||||
// ...
|
||||
//=============================================================================================
|
||||
|
||||
public class FriendDoc : DynamoDbDocBase
|
||||
{
|
||||
public FriendDoc()
|
||||
: base(typeof(FriendDoc).Name)
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<FriendAttrib>());
|
||||
}
|
||||
|
||||
public FriendDoc(string ownerGuid, string friendGuid)
|
||||
: base(typeof(FriendDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPK(ownerGuid);
|
||||
setCombinationKeyForSK(friendGuid);
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
appendAttribWrapper(new AttribWrapper<FriendAttrib>());
|
||||
}
|
||||
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return "friend#";
|
||||
}
|
||||
|
||||
protected override string onMakePK()
|
||||
{
|
||||
return $"{onGetPrefixOfPK()}{getCombinationKeyForPK()}";
|
||||
}
|
||||
|
||||
protected override string onMakeSK()
|
||||
{
|
||||
return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}";
|
||||
|
||||
}
|
||||
|
||||
// protected override string onGetPrefixOfSK()
|
||||
// {
|
||||
// return "";
|
||||
// }
|
||||
|
||||
|
||||
//onCopyFromDocument(document)
|
||||
|
||||
|
||||
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetPK(string pk)
|
||||
{
|
||||
getPrimaryKey().fillUpPK(pk);
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
||||
{
|
||||
getPrimaryKey().fillUpSK(sortKey);
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user