public UniqueIndex(DocumentMapping mapping, MemberInfo[][] members) { _members = members; _locator = members .Select(m => { var sql = mapping.FieldFor(m).SqlLocator.Replace("d.", ""); switch (Casing) { case Casings.Upper: return($" upper({sql})"); case Casings.Lower: return($" lower({sql})"); default: return($" ({sql})"); } }) .Join(","); _locator = $" ({_locator})"; _table = mapping.Table; }
public void UnknownPGTypesMapToJsonb() { var mapping = new DocumentMapping <UserNested>(new StoreOptions()); var field = mapping.FieldFor(x => x.Nested); Assert.Equal("CAST(d.data ->> 'Nested' as jsonb)", field.TypedLocator); }
// TODO -- use the mapping off of DocumentQuery later public string JsonLocator(DocumentMapping mapping, Expression expression) { var visitor = new FindMembers(); visitor.Visit(expression); //return new JsonLocatorField(visitor.Members.ToArray()).SqlLocator; var field = mapping.FieldFor(visitor.Members); _query.RegisterField(field); return(field.SqlLocator); }
public IField FieldFor(IEnumerable <MemberInfo> members) { return(_inner.FieldFor(members)); }