Skip to content

Make FieldName Properties Public #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/NRedisStack/Search/FieldName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ namespace NRedisStack.Search
{
public class FieldName
{
private readonly string fieldName;
private string? alias;
public string Name { get; }
public string? Alias { get; private set; }

public FieldName(string name) : this(name, null) { }

public FieldName(string name, string? attribute)
{
this.fieldName = name;
this.alias = attribute;
this.Name = name;
this.Alias = attribute;
}

public int AddCommandArguments(List<object> args)
{
args.Add(fieldName);
if (alias == null)
args.Add(Name);
if (Alias is null)
{
return 1;
}

args.Add("AS");
args.Add(alias);
args.Add(Alias);
return 3;
}

Expand All @@ -33,7 +33,7 @@ public static FieldName Of(string name)

public FieldName As(string attribute)
{
this.alias = attribute;
this.Alias = attribute;
return this;
}
}
Expand Down
Loading