This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isAvailable<Obj>( | |
| obj: Obj, | |
| key: string | number | symbol | |
| ): key is keyof Obj { | |
| return key in obj; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Text.Json.Serialization; | |
| using Couchbase; | |
| using Couchbase.Linq; | |
| using Newtonsoft.Json; | |
| using couch; | |
| using Couchbase.Linq.QueryGeneration; | |
| using Couchbase.Linq.QueryGeneration.MemberNameResolvers; | |
| using Couchbase.Linq.Utils; | |
| using Couchbase.Linq.Versioning; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT $ FROM post | |
| INCLUDE categories,tags | |
| where $.Categories[*].$id any in [ 7 , 10] | |
| SELECT *.Categories[*], sum(*.Categories[*].id) as c | |
| FROM post | |
| --include $.Categories | |
| where $.Categories!=null and Count($.Categories[*])>0 and $.$missing any !=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services.AddDbContextPool<dbContext>(options => options.UseSqlite(conn)); | |
| //.UseSqlServer(connection)); | |
| //with scoped | |
| //services.AddScoped<DmServices>(); | |
| //with singleton | |
| // services.AddSingleton<DmServices>(s => | |
| // new DmServices(new ProsperusContext( | |
| // new DbContextOptionsBuilder<dbContext>().UseSqlite(conn).Options))); | |
| services.AddSingleton<DmServices>(s => | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://github.com/aspnet/Mvc/blob/a78f77afde003c4a3fcf5dd7b6dc13dd9c85f825/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/Conventions/WebApiParameterConventionsApplicationModelConvention.cs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| groupBy(array: any[], property: string) { | |
| return array.reduce((prev, next) => { | |
| // If the group doesn't exist, create it | |
| if(!prev[property]) { prev[property] = [next]; } | |
| // Else, we push it in | |
| else { prev[property].push(next); } | |
| // Mandatory return | |
| return prev; | |
| }, {}); | |
| } |