mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 02:22:26 -05:00 
			
		
		
		
	This allows for building GoToSocial with [SQLite transpiled to WASM](https://github.com/ncruces/go-sqlite3) and accessed through [Wazero](https://wazero.io/).
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			383 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			383 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package util
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 
 | |
| 	"github.com/tetratelabs/wazero/experimental"
 | |
| )
 | |
| 
 | |
| type moduleKey struct{}
 | |
| type moduleState struct {
 | |
| 	mmapState
 | |
| 	handleState
 | |
| }
 | |
| 
 | |
| func NewContext(ctx context.Context) context.Context {
 | |
| 	state := new(moduleState)
 | |
| 	ctx = withAllocator(ctx)
 | |
| 	ctx = experimental.WithCloseNotifier(ctx, state)
 | |
| 	ctx = context.WithValue(ctx, moduleKey{}, state)
 | |
| 	return ctx
 | |
| }
 |